Author Archives: bgoodman

How to Elegantly Add Row Numbering for DataGridView Tables

There are a few ways to go about adding row numbering for your DataGridView’s, but you have to ensure you have added the code in, where ever you are adding a new row. If your inserting a row, then you have to go back and update all your numbering. With the option shown here, you need not worry about updating any row numbers when working with the DataGridView.


Once you add the event for the ‘RowPostPaint’, the code (function header outlined in red) just needs to be updated to reference the routine (function header outlined in green). I keep the numbering routine in its own block of code so that is can be reused by other DataGridView tables on the same form.

private void dgv_CompanySites_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
bg_DGV_RowPostPaint(sender, e);

private void bg_DGV_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
     var bgDGV = sender as DataGridView;
    var bgRowIdx = (e.RowIndex + 1).ToString();

    var centerFormat = new StringFormat()
        // right alignment might actually make more sense for numbers
        Alignment = StringAlignment.Center,
        LineAlignment = StringAlignment.Center

    var headerBounds = new Rectangle(e.RowBounds.Left, e.RowBounds.Top, bgDGV.RowHeadersWidth, e.RowBounds.Height);
    e.Graphics.DrawString(bgRowIdx, this.Font, SystemBrushes.ControlText, headerBounds, centerFormat);

When you load your DataGridView, the RowPostPaint event will be raised to perform row level painting, after all cell painting has occurred. This renders your row numbering nicely, and you do not have to add any additional code for numbering when adding data rows.

The following example shows the numbering where the numbers are low in range:


As your numbering gets higher up in range, the spacing remains nicely proportioned:


Migrating BMC API Applications from 32 Bit WinXP + VS 2005 Express to 64 Bit Windows 7 + VS 2010 Express

Migrating 32 Bit WinXP + VS 2005 Express to 64 Bit Windows 7 + VS 2010 Express

 I was recently upgraded from the 32 Bit WinXP operating system to the 64 Bit Windows 7. With the new OS, I figured it was probably time up move from VS 2005 Express to VS2010 Express, both of which are the C# flavour.

 First, none of my existing application would run on Windows 7. Ok, even using the XP compatibility mode wouldn’t work. The easy solution I figured was I would just have to recompile and magically everything would work fine. When I attempted to load my existing vs2005 projects into vs2010, the projects were successfully converted over by the wizard. Running/debugging the newly converted project resulted in some additional errors. Slowly each error was resolved and I finally had a solution that worked and was repeatable across all the small utilities I had (30 in total for 7.6.04. The other 57 applications for 7.1.x will probably never see an upgrade). Presented below are my steps that I have used.

 There are a number of documents and sites out there that will tell you how to install the .NET API for Remedy (ARSystem), but that gets thrown out the door with 64 Bit.

 You will need to locate and download the “ARAPI764_NET” zip file and extract its contents out to a folder. Below is the format that I have used to help keep everything organized. I have another folder (not shown below) called “Remedy Utilities” where the same sets of files are stored, but I also drop into this folder, all the executable files that I build. This way I have many applications all sharing the same set of library files.





You will not be able to register the BMC DLL files with the regasm for the 4.x Framework. This is due to the security changes made in this version. You’re running under 64 Bit, which again won’t work well with the BMC DLL files as they were compiled for 32 Bit.

Once your directories are setup, you just need to start converting over your VS2005 projects to VS2010.

The following link will allow you to download the PDF which contains the process that I have used successfully, along with screen shots (PDF seemed to be an easier format to reference):

 Updating existing projects to work with VS2010


Troubleshooting Plugins


For reference and to assist in the troubleshooting process, we have listed the following plugins used in the applcation.  The reference shows the plugin name as seen in the corresponding ar.cfg/ar.conf file, the actual plugin name shown in the Plugin log, and what the specific plugin does.
Plugin: arapprove

What it does:Runs the approval process
Plugin: libcmdbconsolefilterapi20

Actual Plugin Name:  BMC.ARF.CMDBCONSOLE
What it does: Used to compare instances in CMDB Console

Plugin: ardbcQuery

What it does: Used to query the overview console and return data from the vendor form for Incident, Problem, Change and Asset

Plugin: arfcbdata

Actual Plugin Name:  REMEDY.ARF.CBDATA
What it does: Used for chargebacks

Plugin: caieventcmd

Actual Plugin Name:  REMEDY.ARF.CAI
What it does: Takes data from the CAI Event form and creates a record in the appropriate Interface_Create form.

Plugin: omfobjiefilapi

Actual Plugin Name:  REMEDY.ARF.OMFOBJIE
What it does: Used for exporting sla’s

Plugin: arfslasetup

What it does: When you Register Application forms in SLA, this builds the _SLA join form

From the application standpoint we expect to see the ar.cfg/ar.conf file show the Plugin and the plugin path.  The plugin path should only be seen one time for each plugin used in multiple apps.  Whichever application was installed first will update the ar.cfg/ar.conf file with the plugin and plugin path.  For example, the caieventcmd plugin on unix would show the following if Problem Management was the first app installed:

Plugin-Path: /usr/arsystem/appslinux02/problem/bin
Plugin: /usr/arsystem/appslinux02/problem/bin/

On a windows server it would show the plugin path and plugin in one line:
Plugin: “D:\AR System Applications\itsm70ars70w2k3\BMC Remedy Problem Management\bin\caieventcmd.dll”


Troubleshooting ARERR [8755] The specified plug-in does not exist errors: <Plugin Name>

The name of the plugin will show in the above error.  For this type of error message, you must know the actual plugin name from above, for example, REMEDY.ARF.CAI, to know which entry to look for in the ar.cfg/ar.conf file. 

1.  Verify the ar.cfg/ar.conf file has the plugin and plugin path.
On windows:
 “D:\AR System Applications\itsm70ars70w2k3\BMC Remedy Problem Management\bin\caieventcmd.dll”

Plugin-Path: /usr/arsystem/appslinux02/problem/bin
Plugin: /usr/arsystem/appslinux02/problem/bin/

2.  For the above location, go to the directory on the server and verify that the actual plugin resides in the directory listed and permissions are consistent with the user arserverd/arserver.exe run as (especially important when transitioning to a non-root install.)


Troubleshooting ARERR [8939] The AR System Plug-In server is not responding.  Cannot connect to the system at this time.  Contact your AR System Administrator for assistance. : RPC: Timed out

1.Enable Plugin and API logging on the server and perform the action that generates the timeout message.
2.Review both the Plugin and API log for delays in processing.  3.If the delay occurs in the Plugin log but the API log looks ok, then the issue is with the plugin entries in the ar.cfg/ar.conf file.

You should have the following:
 Server-Plugin-Default-Timeout:<your setting>
 Plugin-Loopback-RPC-Socket: <your setting>
 Plugin-ARDBC-Threads: <your setting>
 Plugin-Filter-API-Threads: 1 15
***Please see the AR System Configuration Guide beginning on page 330 for more information on these settings and how to adjust them for your specific environment*****

4.For the REMEDY.ARF.CAI plugin, make sure Approval Server is installed and you have configured the CAI:Plugin registry form as noted on page 124 of the BMC Remedy IT Service Management Architecture Guide  As a technique for reducing thread contention, the private queue and number of threads to be used for the CAI plug-in can be defined using this form. To use this feature, you must define a private queue using BMC Remedy Administrator, and then update the CAI Plug-in Registry with the queue number and number of threads. If the applications are running on a specific port and not on portmapper, you will need to update the plugin from patch 004 of the applications. A change was made to this plugin to allow it run on a specific port. 
5.  If the delay is in the API logging, then the server may not have enough fast and list threads to perform plugin operations.  Adjust your threads via the Administrator tool as needed.