Problems binding to COM based SDK

I'm attempting to write a WIndows Forms UI for a Com based SDK.  The SDK requires the creation of a session object from which object factories and data structures are available.

Language: VisualBasic
Visual Studio: 2002 .Net 1.0

One of the data structures returned is a list of objects to which I would like to bind some UI controls.  Unfortunately I receive the following error on execution of:

TextBox1.DataBindings.Add("Text", objProject, "Name")

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll

Additional information: Can't bind to property or column Name on DataSource.

The following code, for example does work:

        For Each objProject In session.Projects
            Debug.WriteLine("Name:"  & objProject.Name)
        Next

I recall reading somewhere that binding happens before dynamic initilization of variables and that you must explicitly initialize variables.  I suspect the variables in my SDK may not be explicitly initialized which might be the source of my problem.

Questions: Is there a way to determine for certain if variable initilization is the source of my problem and is the best way around this to write a .Net wrapper around my SDK

Thanks,
Shane


Answer this question

Problems binding to COM based SDK

  • Bernd Boot

    Yes you want them to be intialized but they also must be a bindable type, the object must implement ibindinglist in order for it to be a bindable object. Otherwize use a bindable object (datatable, arraylist).

    Hope this gives you some clues.

    also check this out.
    http://www.syncfusion.com/FAQ/WinForms/default.asp#43

  • Problems binding to COM based SDK