Data Binding to array/list

  • Thread starter Thread starter KCT
  • Start date Start date
K

KCT

I am creating a report screen then look like this :

ItemName Quantity
A 1
B 2
C 3
--End of Page--

The data is not store in the database. Supposely that my application gets
the data from a list or array, how do I do a data binding to the above
fields ?
 
You can set the DataSource of the control to the ArrayList or whatever
collection class you are using.
 
Then you can use

//Where myArray holds a collection of item names and 'i' is the index of the
item
textLabel.DataBindings.Add("Text",myArray,"ItemName");
 
Back
Top