Personal Mind of ASEP

Sepercik Rasa yang Tercurah

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

February 16, 2006 - Posted by | Uncategorized

No comments yet.

Leave a Reply

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 / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: