Value of Boolean column does not change

mcutchin

New member
Joined
Jul 6, 2005
Messages
2
Programming Experience
3-5
All,

I have created a data set from an oracle data adapter and added a data column (type = boolean, name = "Select") to the datatable. The results are displayed in a datagrid. When the user clicks on the check box I want the value to be displayed in a msgbox. I assume that the value should shift from True to False depending on the checkmark (whether it appears or not). I run the following code when the datagrid is clicked...





VB.NET:
Private[/color] [color=#00007f]Sub[/color] DataGrid1_Click([color=#00007f]ByVal[/color] sender [color=#00007f]As[/color] [color=#00007f]Object[/color], [color=#00007f]ByVal[/color] e [color=#00007f]As[/color] System.EventArgs) [color=#00007f]Handles[/color] DataGrid1.Click 

 
[color=#00007f]Dim[/color] pt [color=#00007f]As[/color] System.Drawing.Point = DataGrid1.PointToClient(Cursor.Position) 
[color=#00007f]Dim[/color] hti [color=#00007f]As[/color] DataGrid.HitTestInfo = DataGrid1.HitTest(pt) 
[color=#00007f]If[/color] hti.[color=#00007f]Type[/color] = DataGrid.HitTestType.Cell [color=#00007f]Then[/color] 
MessageBox.Show([color=#00007f]CType[/color](DataSet21.Tables(0).Rows(hti.Row).[color=#00007f]Item[/color]("Select"), [color=#00007f]String[/color])) 
[color=#00007f]End[/color] [color=#00007f]If[/color] 
[color=#00007f]End[/color] Sub[color=#00007f]




"Select" is the column name of the boolean value column I added to the dataset. The default value is "False." Regardless of whether or not the checkbox is check or unchecked, the messagebox output is always false whenever I click on the datagrid. Any ideas on how I can return the correct value of the checkbox?

Thanks in advance...
 
Data in DataGrids doesn't change the underlying data source until it gets validated. You may find that you have to move to a different cell or a different row to have your changes reflected in the table itself.
 
Back
Top