1. Font Color & Font Style
Kode Program :
Private Sub ChkBold_Click()
‘membuat teks tebal
If ChkBold.Value = 1 Then
Lblteks.FontBold = True
Else
Lblteks.FontBold = False
End If
End Sub
Private Sub OptRed_Click()
‘membuat teks berwarna merah
Lblteks.ForeColor = vbRed
End Sub
2. STATUS
Kode Program
‘jika status single dipilih, mendapat tunjangan 50000
‘jika status menikah dipilih, maka mendapat tunjangan 80000
Private Sub Optsingle_Click()
If Optsingle.Value = 1 Then
tunjangan = 50000
End If
End Sub
3. DIALOG
Kode Program
Private Sub cmdColor_Click()
cmdDialog.dialogtitle = “select a color”
cmdDialog.showcolor ‘display the dialog box
End Sub
Private Sub cmdFont_Click()
cmdDialog.dialogtitle = “font”
cmdDialog.FileName = “arial”
cmdDialog.FontBold = cdlCFBoth
cmdDialog.showfont
End Sub
Private Sub cmdOpen_Click()
cmdDialog.dialogtitle = “file open”
cmdDialog.Filter = “*.txt” ‘tampilkan text saja
cmdDialog.FileName = “*.txt” ‘default nama file
cmdDialog.showopen ‘menampilkan dialog open file
End Sub
Private Sub cmdPrint_Click()
cmdDialog.dialogtitle = “printer”
cmdDialog.showprinter ‘display the dialog box
End Sub
Private Sub cmdSave_Click()
cmdDialog.dialogtitle = “file save”
cmdDialog.Filter = “**” ‘show all files
cmdDialog.FileName = “test.txt” ‘default filename
cmdDialog.showsave ‘tringger the dialog box
End Sub