PRAKTIKUM
Desain form dengan tampilan seperti pada gambar berikut
Ubah propertis komponen MSFlexgrid:
col = 3
row = 1
kemudian ketik listing program berikut pada jendela kode editor
Private Sub Command1_Click()
Dim a As String
Dim b As String
Dim c As String
a = Text1.Text
b = Text2.Text
c = MSFlexGrid1.Rows
MSFlexGrid1.AddItem c + vbTab + a + vbTab + b
End Sub
Private Sub Command2_Click()
If MSFlexGrid1.Rows = 1 Then
MsgBox "TIDAK ADA DATA", vbCritical, "Error"
Else
MSFlexGrid1.Rows = MSFlexGrid1.Rows - 1
End If
End Sub
Private Sub Form_Load()
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 0
MSFlexGrid1.Text = "No"
MSFlexGrid1.Col = 1
MSFlexGrid1.Text = "Nama"
MSFlexGrid1.Col = 2
MSFlexGrid1.Text = "NIM"
End Sub
Dim a As String
Dim b As String
Dim c As String
a = Text1.Text
b = Text2.Text
c = MSFlexGrid1.Rows
MSFlexGrid1.AddItem c + vbTab + a + vbTab + b
End Sub
Private Sub Command2_Click()
If MSFlexGrid1.Rows = 1 Then
MsgBox "TIDAK ADA DATA", vbCritical, "Error"
Else
MSFlexGrid1.Rows = MSFlexGrid1.Rows - 1
End If
End Sub
Private Sub Form_Load()
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 0
MSFlexGrid1.Text = "No"
MSFlexGrid1.Col = 1
MSFlexGrid1.Text = "Nama"
MSFlexGrid1.Col = 2
MSFlexGrid1.Text = "NIM"
End Sub
Jalankan Program
No comments:
Post a Comment