VB 2005 Gridview question
-
I have a gridview in a VB2005 project that contains a checkbox. In VB2003 I used a datagrid and I have the code to read the datagrid to determine how many and which boxes were checked. I am having trouble converting my code to use a gridview. How do you in VB2005 read a gridview and determine if the checkbox was checked? Thanks
-
I have a gridview in a VB2005 project that contains a checkbox. In VB2003 I used a datagrid and I have the code to read the datagrid to determine how many and which boxes were checked. I am having trouble converting my code to use a gridview. How do you in VB2005 read a gridview and determine if the checkbox was checked? Thanks
There are many ways to do this. Probably the easiest way would be to add a DataGridViewCheckBoxColumn to your GridView. Then set the FalseValue property and the TrueValue property of this column. Then set the DataPropertyName property to the field you want to bind this control to from your DataTable/DataSet or whatever you are binding to the DataGrid. Now when the box is checked that field in the DataTable/DataSet will be set to whatever value you set as the TrueValue property. I hope this at least will put you on the right track. Good luck.