P
pmclinn
Below is the code I'm using to dynamically fill a datagrid from a
datatable (fed by an ole connection). Everything is working great
except that my users have to click 2 time on the checkbox to select it,
and if they click on it again it gets greyed out... click on the check
again and then it disapears.
What I want is to be able to be able to:
Click on the box once to check it.
Click on it again to remove the check.
How do you fix this issue?
Dim sql As String = "select A, b, c, d...."
Dim sConnString As String = _
"Provider...."
Dim myConnection As New OleDbConnection
dgResults.DataSource = dt
dt.Columns.Add("Yes/No", System.Type.GetType("System.Boolean"))
dt.Columns.Add("Number", System.Type.GetType("System.String"))
dt.Columns.Add("LOT", System.Type.GetType("System.String"))
dt.Columns.Add("House", System.Type.GetType("System.String"))
dt.Columns.Add("Node", System.Type.GetType("System.String"))
Dim dr As DataRow
dr = dt.NewRow
Try
myConnection = New OleDb.OleDbConnection(sConnString)
Dim myCommand As New OleDbCommand(sql, myConnection)
myConnection.Open()
Dim myReader As OleDbDataReader = myCommand.ExecuteReader
Dim intCounter As Integer = 0
While myReader.Read()
dr = dt.NewRow
dr(0) = False
dr(1) = myReader(0)
dr(2) = myReader(1)
dr(3) = myReader(2)
dr(4) = myReader(3)
dt.Rows.Add(dr)
intCounter += 1
End While
txtCount.Text = CType(intCounter, String)
myReader.Close()
myConnection.Close()
myConnection.Dispose()
Catch
Console.Out.WriteLine("Error: " & Err.Description)
myConnection.Close()
myConnection.Dispose()
End Try
datatable (fed by an ole connection). Everything is working great
except that my users have to click 2 time on the checkbox to select it,
and if they click on it again it gets greyed out... click on the check
again and then it disapears.
What I want is to be able to be able to:
Click on the box once to check it.
Click on it again to remove the check.
How do you fix this issue?
Dim sql As String = "select A, b, c, d...."
Dim sConnString As String = _
"Provider...."
Dim myConnection As New OleDbConnection
dgResults.DataSource = dt
dt.Columns.Add("Yes/No", System.Type.GetType("System.Boolean"))
dt.Columns.Add("Number", System.Type.GetType("System.String"))
dt.Columns.Add("LOT", System.Type.GetType("System.String"))
dt.Columns.Add("House", System.Type.GetType("System.String"))
dt.Columns.Add("Node", System.Type.GetType("System.String"))
Dim dr As DataRow
dr = dt.NewRow
Try
myConnection = New OleDb.OleDbConnection(sConnString)
Dim myCommand As New OleDbCommand(sql, myConnection)
myConnection.Open()
Dim myReader As OleDbDataReader = myCommand.ExecuteReader
Dim intCounter As Integer = 0
While myReader.Read()
dr = dt.NewRow
dr(0) = False
dr(1) = myReader(0)
dr(2) = myReader(1)
dr(3) = myReader(2)
dr(4) = myReader(3)
dt.Rows.Add(dr)
intCounter += 1
End While
txtCount.Text = CType(intCounter, String)
myReader.Close()
myConnection.Close()
myConnection.Dispose()
Catch
Console.Out.WriteLine("Error: " & Err.Description)
myConnection.Close()
myConnection.Dispose()
End Try