Contoh Program VB (VisualBasic)
Disini saya menggunakan Microsoft Visual Studio 2010.
Salah satu contoh hasil program di VB
Tujuan program ini, agar ketika checkbox di klik harga akan keluar di textbox total.
codenya seperti ini
Public Class Form1
Const BB As Integer = 330
Const SS As Integer = 750
Const SX As Integer = 450
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
TextBox1.Text += BB
Else
TextBox1.Text -= BB
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked Then
TextBox1.Text += SS
Else
TextBox1.Text -= SS
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked Then
TextBox1.Text += SX
Else
TextBox1.Text -= SX
End If
End Sub
End Class
Salah satu contoh hasil program di VB
Tujuan program ini, agar ketika checkbox di klik harga akan keluar di textbox total.
codenya seperti ini
Public Class Form1
Const BB As Integer = 330
Const SS As Integer = 750
Const SX As Integer = 450
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
TextBox1.Text += BB
Else
TextBox1.Text -= BB
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked Then
TextBox1.Text += SS
Else
TextBox1.Text -= SS
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked Then
TextBox1.Text += SX
Else
TextBox1.Text -= SX
End If
End Sub
End Class
Comments
Post a Comment