How to bind Array of Objects to Window Forms Control 
Author Message
 How to bind Array of Objects to Window Forms Control

Such declared array has IList interface implemented (MSDN):
Public workers() As Cworker
correct?

IList is only requirement for binding to window form controls (MSDN)
correct?

I initialize that array like this:
ReDim workers(1)
workers(0) = New Cworker("Agent", "Smith")
workers(1) = New Cworker("Neo", "Anderson")
where constructor simply sets properties FirstName and LastName

then I try to bind:
TextBox2.DataBindings.Add(New Binding("text", workers, "FirstName"))

all is described in MSDN and seems be right:
data source object implements iList,
data member is property of current object
but run-time error message is: "Can't bind to property on column FirstName
on datasource
I can't guess what's wrong...

unfortunately examples are only for native data objects like DataTable or
DataSet
there is no example (or I've not found it) for binding custom IList object

HELP!



Mon, 14 Nov 2005 15:23:25 GMT  
 How to bind Array of Objects to Window Forms Control

Hi,

            Try binding to a ArrayList.  

Public workers As ArrayList
 I initialize that array like this:

workers=new arraylist
workers.add(New Cworker("Agent", "Smith"))
workers.add(New Cworker("Neo", "Anderson"))
where constructor simply sets properties FirstName and LastName

 then I try to bind:
 TextBox2.DataBindings.Add(New Binding("text", workers, "FirstName"))

Ken
----------------

Quote:

> Such declared array has IList interface implemented (MSDN):
> Public workers() As Cworker
> correct?

> IList is only requirement for binding to window form controls (MSDN)
> correct?

> I initialize that array like this:
> ReDim workers(1)
> workers(0) = New Cworker("Agent", "Smith")
> workers(1) = New Cworker("Neo", "Anderson")
> where constructor simply sets properties FirstName and LastName

> then I try to bind:
> TextBox2.DataBindings.Add(New Binding("text", workers, "FirstName"))

> all is described in MSDN and seems be right:
> data source object implements iList,
> data member is property of current object
> but run-time error message is: "Can't bind to property on column FirstName
> on datasource
> I can't guess what's wrong...

> unfortunately examples are only for native data objects like DataTable or
> DataSet
> there is no example (or I've not found it) for binding custom IList object

> HELP!



Mon, 14 Nov 2005 18:57:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Binding User Object to controls on Windows Forms ?

2. Determining Object Types in Bound Object Control

3. Help with late binding converting an object to an array

4. Binding a .NET report to an object array

5. Controls bound to a data control on another form

6. Binding a control to data control on a seperate form

7. Binding controls to a data control on a different form

8. Binding field controls on control (form) within datarepeater cont rol

9. Binding to Control Array

10. Set Bound Object Frame Control Source with Function?

11. Controlling a digital camera from a bound object frame

12. Using the MS-Access Bound Object Frame Control

 

 
Powered by phpBB® Forum Software