I have a Database that looks like this
as what you see on the image above all of the columns except Month
are TinyInt(1)
and Month
is Varchar
now I have a code here
Dim con1 As MySqlConnection = New MySqlConnection("server=192.168.2.87;userid=root;password=admin1950;database=inventory")
Dim sql1 As MySqlCommand = New MySqlCommand("Select * from ri_closure", con1)
Dim ds1 As DataSet = New DataSet
Dim adapter1 As MySqlDataAdapter = New MySqlDataAdapter
con1.Open()
adapter1.SelectCommand = sql1
adapter1.Fill(ds1, "MyTable")
DataGridView2.DataSource = ds1.Tables(0)
con1.Close()
ds1.Tables(0).Columns(2).DataType = GetType(Boolean)
Me.DataGridView2.Columns(1).Frozen = True
Dim i As Integer
For i = 0 To DataGridView2.Columns.Count - 1
DataGridView2.Columns.Item(i).SortMode = DataGridViewColumnSortMode.Programmatic
Next
DataGridView2.Columns(0).Visible = False
DataGridView2.Columns(1).DefaultCellStyle.BackColor = Color.LightBlue
Now this is what it looks like
Now you see the output and I'm sure you dont that want that red ones. Irritating in the eyes and here is my code for that
For Each rw As DataGridViewRow In DataGridView2.Rows
For ii As Integer = 2 To rw.Cells.Count - 1
If rw.Cells(ii).Value = False Then
rw.Cells(ii).Style.BackColor = Color.Red
ElseIf rw.Cells(ii).Value = True Then
rw.Cells(ii).Style.BackColor = Color.White
End If
Next
Next
Now here is my question and I hope it is possible. I want to do something like this instead uncked and turn the cell in to red How can I make the uncked cell like this.
instead of empty checkbox it will look the same as the image above.
and another one I hope the that will generate filled checkbox will replace the uncheked value because I have code in checking of that one.
I try some code and this is the output
TYSM for future help