I am using windows forms and vb.net.
My problem is a little complex so please bear with me.
I have written an application that references a .com based API linked to an external
client application.
The API exposes client user interface objects. One of the objects is similar to a grid.
The first part of my application creates a reference to the grid object in the client
application.
Now, I take that object and pass it to a class I have created in a class library that
accepts that object type in its constructor.
My class only has one function and that takes the gridlike object and converts/returns it
as an untyped dataset.
Let me say that the code to this point the code seems to be working just fine. The
returned dataset can be written out as XML and it all looks good.
The problem comes here:
I tried to create a new form class that accepts a dataset in its constructor. I pass it
a dataset that I have returned from the class detailed above.
During the form load, I try to databind to the dataset and I run into an endless loop of
some sort. The grid never appears, the data never bind etc.
I know I am missing something. I thought I might be able to pass datasets around in this
manner but perhaps I cannot. I know I can do work arounds but I am interested in the
answer as to why this doesn't work.
PSEUDO_CODE
//////////////////////////////////////////////////
MAIN APPLICATION
''Has reference to com API of client user interface
Private _MyDataset as dataset
Sub CatchAnEvent()
Dim MyClientInterfaceGridObject
Dim New MyClass(MyClientInterfaceGridObject)
_MyDataset = MyClass.ReturnDatasetFromGridlikeObject
''All is good to here. If I write the xnl out of the dataset it looks fine.
Dim MyNewForm as new form1(_MyDataset)
MyNewForm.show ''Here is where the problem occurs. MyNewForm gets stuck loading
End Sub
//////////////////////////////////////////////////
//////////////////////////////////////////////////
FORM1
''Plain old windows form. I have altered the "New" to accept a dataset
Private _ds as dataset
Public Sub New(byVal ds as dataset)
MyBase.New()
InitializeComponent()
_ds = ds
End Sub
Private Sub FormLoad
'I have tried a number of methods of databinding with two different grids...
'Here is the last one I tried using an MS grid...
datagrid1.setdatabinding(_ds, _dsTables(0).Tablename)
End Sub
///////////////////////////////////////////////////
Any help would be appreciated. I am wondering if I might have to do some serialization to
create something I can bind to when passing an untyped dataset around like this.
Thanks in advance!