ใส่ความเห็น

VB6.0 Add Check box on MSflexgrid +Explanation


Const strChecked = “þ” ‘for checked
Const strUnChecked = “q”‘for unchecked

‘MSFlexGrid1 is name of this table
Private Sub Form_Load()
With MSFlexGrid1
.Rows = 10
.Cols = 3

.AllowUserResizing = flexResizeBoth

‘name the cols
For i = 1 To .Cols – 1
.Row = 0
.Col = i
.Text = “Column ” & i
Next i

‘name the rows
For i = 1 To .Rows – 1
.Col = 0
.Row = i
.Text = “Row ” & i
Next i

‘define fields as checkbox
For y = 1 To .Rows – 1
For x = 1 To .Cols – 1
.Row = y
.Col = x
.CellFontName = “Wingdings”
.CellFontSize = 14
.CellAlignment = flexAlignCenterCenter
.Text = strUnChecked
Next x
Next y
End With

End Sub

Private Sub Form_Resize()
MSFlexGrid1.Width = Me.ScaleWidth
MSFlexGrid1.Height = Me.ScaleHeight
End Sub

Private Sub TriggerCheckbox(iRow As Integer, iCol As Integer)
With MSFlexGrid1
If .TextMatrix(iRow, iCol) = strUnChecked Then ‘if uncheck then check
.TextMatrix(iRow, iCol) = strChecked
Else
.TextMatrix(iRow, iCol) = strUnChecked
End If
End With
End Sub

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Or KeyAscii = 32 Then ‘Enter/Space
With MSFlexGrid1
Call TriggerCheckbox(.Row, .Col)
End With
End If
End Sub

Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
With MSFlexGrid1
If .MouseRow 0 And .MouseCol 0 Then
Call TriggerCheckbox(.MouseRow, .MouseCol)
End If
End With
End If
End Sub

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s

แปลเพลง VB 6.0 VB 2010 source code

VB2010 แปล แปลเพลง เนื้อเพลง VB 6.0 โหลดเพลงฟรี โหลดเพลง โหลด Mediafire เพลงลูกทุ่ง เพลงใหม่ เพลงลูกทุ่งมาใหม่ เพลงมันส์ โหลดเพลง free เพลงสตริง สตริง

Pathrix's Blog

journal and other stories

%d bloggers like this: