Jumat, 25 Februari 2011

Contoh Program Sederhana



Public Class Form1
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style Or FontStyle.Bold)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Bold)
End If
End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox1.Checked Then
TextBox2.Font = New Font(TextBox2.Font, Label2.Font.Style Or FontStyle.Italic)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Italic)
End If
End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox1.Checked Then
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style Or FontStyle.Underline)
Else
TextBox2.Font = New Font(TextBox2.Font, TextBox2.Font.Style And Not FontStyle.Underline)
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = TextBox1.Text
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub

End Class


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked Then
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
End If
If RadioButton2.Checked Then
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
End If
If RadioButton3.Checked Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
End If
If RadioButton4.Checked Then
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End If

End Sub

End Class

Tidak ada komentar:

Posting Komentar