You could use the cells Picture property to be a checkbox picture , either selected or unselected.
See the code below.
First i create both selected and unselected checkbox pictures to use.
Then in column[1] i set each rows text and use the unselected checkbox picture for column[0].
the IsSelected() method checks if the picture in column[0] is the off image or not.
as the form closes it tells you the values of the checkboxes.
You can easily set values on load in the tableview checkboxes by using either the pOn or pOff pictures
You could easily use a different column number
Hope it helps...
' Gambas class file
Private pOff As New Picture(24, 24)
Private pOn As New Picture(24, 24)
Public Sub Form_Open()
' make our selected and unselected checkbox images
Paint.Begin(pOff)
Style.PaintCheck(0, 0, 24, 24, False)
Paint.End
Paint.Begin(pOn)
Style.PaintCheck(0, 0, 24, 24, True)
Paint.End
TableView1.Columns.Count = 2
For c As Integer = 0 To 9
Inc TableView1.Rows.Count
TableView1[TableView1.Rows.Max, 0].Picture = pOff
TableView1[TableView1.Rows.Max, 1].Text = "Item " & c
Next
TableView1.Columns[0].Width = -1
End
Public Sub TableView1_Click()
If TableView1.Column = 0 Then
If IsSelected(TableView1.Current) Then
' Do your function if checking off
TableView1.Current.Picture = pOff
Else
' Do your function if checking on.
TableView1.Current.Picture = pOn
Endif
Endif
End
Private Sub IsSelected(Cell As _GridView_Cell) As Boolean
If Cell.Picture = pOff Then Return False
Return True
End
Public Sub ButtonClose_Click()
For c As Integer = 0 To TableView1.Rows.Max
Print TableView1[c, 0].Text, IsSelected(TableView1[c, 0])
Next
Me.close
End
I guess something like this (put your condition in WhateverMakesItTrue)...
WITH dbResult
tb.rows.count = .count
i = 0
WHILE i < .count
tb[i, 0].Picture = If(WhateverMakesItTrue, pOn, pOff)
tb[i, 0].Text = dbResult!name
tb[i, 1].Text = dbResult!width
tb[i, 2].Text = dbResult!height
tb[i, 3].Text = dbResult!isValid
i = i + 1
.MoveNext
WEND
END WITH