Filling a .NET dropdown with code table entries
David Zeidman
One of the good things about the CCodeTablesServer class is the ability to fill a combo with code table entries. For example if I have a custom form and want to be able to allow the user to select say, a title, I can simply call the CCodeTablesServer class method LoadCombo and my combo is filled up with titles. Well it is if I am using a COM environment such as VB6. But what do I do if I am using .NET?
This is not as straight forward but there is a useful method nevertheless. Instead of loading the combo directly we can use the CodeTableGetDataArray method that returns a two dimensional array consisting of the codetable id and the description.
Dim array2d As Object
Dim shortValues As Boolean = False
Dim activeOnly As Boolean = True
Dim codetable As ECodeTableNumbers = ECodeTableNumbers.tbnumTitles
array2d = getCodeTableServer.CodeTableGetDataArray(codetable, shortValues, activeOnly)
For i As Integer = 1 To array2d.GetUpperBound(1)
titlesDropDown.Items.Add(array2d(1, i))
Next i
The getCodeTableServer method simply returns an initialised code table server object for brevity. The CodeTableGetDataArray method would, in the VB6 world return a Variant. Since these are not supported in .NET an Object is return instead. This is a 2d array. The first dimension consists of two elements; the id and the description. The second dimension is as big as the code table has values. In the above example we make use of the description only.
I had known about this method for a while but how do we get the values in the static code tables? These values include things like gift types, pay methods, etc. What this space…
No related posts.
Posted in Intermediate |
3 Comments »
March 30th, 2009 at 9:44 am
[...] a previous post (Filling a .NET dropdown with code table entries) I described how it was possible to fill a .NET dropdown with dynamic code table entries such as [...]
October 26th, 2010 at 10:33 pm
I am using c#.net for my application and regardless of the site I look at, I can not find appropriate syntax for examples reviewing the code table.
What assembly references are needed for this example:
array2d = getCodeTableServer.CodeTableGetDataArray(…
Just trying to see what I am missing to help get my use of the API off the ground.
October 27th, 2010 at 1:39 pm
Blake,
You need to simply add the regular BBREAPI assembly found in the C:\Program Files\Blackbaud\The Raisers Edge 7\PIA directory
David