[2.0] datagridview column bind?
I have an arraylist as my datasource.
Obviously you cannot directly bind this to the datagridview, so I have to go through each item in the collection, then add the items in the datagridview.
question is, how can I specify which column to place the current data in the datagridview?
so if we have col1, col2, col3, I wish to add the items in col2
I tried:
..
this.theDataGridView.Rows[counter].Cells["MyColumn2"].Value = currentObject.ToString();
..
but going round after the first time, throws an argumentoutofrange exception in the Cells.
thanks!
Re: [2.0] datagridview column bind?
got it, had to add a new row in the foreach loop
*embarrased*
1 Attachment(s)
Re: [2.0] datagridview column bind?
Um, of course you CAN actually bind the ArrayList to the grid. The only requirement is that the objects in collection expose the values you want to display through public properties.
Re: [2.0] datagridview column bind?
well I wasnt referring to objects, just simple strings like "hi" "hello" etc..., not collections of object :)
shoulve made it clearer, my apologese