Currently I have a problem of not being able to edit the checkbox on the grid. The datagrid bound to a dataset which is filled by a DataAdapter. Since the table stored in MySql at run-time, I do not know the fields in advace, therefore I have to get data from database to dataset via Adapter. Also in MySQL boolean type is present at tinyint(1). Thus when being filled in dataset, it has "SByte" type instead of "Boolean" type .
Here is my code:
myAdapter.SelectCommand = New MySqlClient.MySqlCommand("select * from inspection_temp", myCon)
myBuilder = New MySqlClient.MySqlCommandBuilder(myAdapter)
Private Sub format_grid()
Dim i As Integer
Dim data_type, col_name As String
Dim grdStyle As New DataGridTableStyle
.MappingName = "inspection_temp"
For i = 0 To (ds.Tables("inspection_temp").Columns.Count - 1)
data_type = ds.Tables("inspection_temp").Columns(i).DataType.Name
col_name = ds.Tables("inspection_temp").Columns(i).ColumnName
If data_type = "SByte" Then
.MappingName = col_name
.HeaderText = col_name
.ReadOnly = False
.NullText = ""
The Datagid displays grey checkbox which I can edit when having focus, but when I tab to the next cell it goes back to the grey checkbox. other columns in the datagrid are editable as they are String and Number types.
Anyone could help,please