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…