Click to See Complete Forum and Search --> : setting a field in datagrid as checkbox from code in VB


iamnemani
October 22nd, 2001, 04:51 AM
hi

Can anyone tell me the exact syntax to set a particular column in a datagrid as a checkbox from the code.

Thankx,
Nemani.

Iouri
October 22nd, 2001, 07:17 AM
DBGrid
column (grid.columns(index).style = ssStyleCheckBox

for msflexgrid you can use this code

'on the form:
'one flexgrid (named= flex1), 1 fixed row,2 fixed cols
'one checkbox (named= check1) with index = 0
Private Sub Form_Load()
Dim intX As Integer
Check1(0).Visible = False
With flex1
.Cols = 5
.Rows = 5
For intX = 1 To (.Rows - .FixedRows)
Load Check1(intX)
Check1(intX).Caption = ""
Check1(intX).Width = 200
Check1(intX).BackColor = .BackColor
Check1(intX).Top = .Top + .RowHeight(intX - 1) * intX + 50
Check1(intX).Left = .Left + .ColWidth(0) / 2
Check1(intX).Height = .CellHeight - 20
Check1(intX).Visible = True
Check1(intX).ZOrder 0
Next intX
End With
End Sub

'each indexed check refers to a non fixed row
'ie: check(1)= the first non fixed row
'and so on
'on the form:


Iouri Boutchkine
iouri@hotsheet.com