≡ Menu

Cara bikin check box do FlexGrid

gw baru kelar gimana caranya ngebikin checkbox di FlexGrid, ini gw bikin supaya kabag akademik di tempat gw gawe bisa pilih beberapa pilihan untuk proses approval dan reject rencana studi dan nilai mahasiswa. nah seperti biasa gw acak2 lagih tuh planet-source-code.com nah dapat deh logika programnya ( hehehe nyontek molo yeee :D)
Deklarasi Variable

Dim Z As Integer
Const strChecked = “?”
Const strUnChecked = “q”

Bikin Sebuah sub yang akan di panggil ketika terjadi event di grid

Private Sub TriggerCheckbox(iRow As Integer, iCol As Integer)
With MSFlexGrid1
If .TextMatrix(iRow, 10) = strUnChecked Then
.TextMatrix(iRow, 10) = strChecked
Else
.TextMatrix(iRow, 10) = strUnChecked
End If
End With
End Sub

Di FlexGrid pada event Mouse Down isikan kode ini

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

Nah selanjutnya masukin deh kode yang dibawah ini, untuk nampilin si cekboknya

With MSFlexGrid1
For y = 1 To .Rows – 1
.Row = y
.Col = 10
.CellFontName = “Wingdings”
.CellFontSize = 14
.CellAlignment = flexAlignCenterCenter
.Text = strUnChecked
Next y
End With

{ 1 comment… add one }
  • wawan February 24, 2016, 10:54 pm

    thank you banget sob codingnya,,,,

Leave a Comment