Latihan 1 Materi Pengenalan Group Box , Radio Button Dan Chekck Box

Masuk ke new project -> visual basic ->windows form

Public Class Form1

 

Public Class Form1

 

End Class

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

‘ mendaklarasikan objek dengan mengganti nama textnya, bisa dilakukan juga di properties

Label3.Text = “Membuat Style Font”

Label2.Text = “Isikan Kalimat”

Label1.Text = “”

RadioButton1.Text = “Merah”

RadioButton2.Text = “Biru”

RadioButton3.Text = “Hijau”

RadioButton4.Text = “Coklat”

CheckBox1.Text = “Bold”

CheckBox2.Text = “Italic”

CheckBox3.Text = “StrikeOut”

CheckBox4.Text = “Underline”

Button1.Text = “Jalankan”

GroupBox1.Text = ” Masukkan Data”

GroupBox2.Text = ” Pilihan Kata”

End Sub

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Label1.Text = TextBox1.Text

End Sub

 

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged

Label1.ForeColor = Color.Green

End Sub

 

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

Label1.ForeColor = Color.Blue

End Sub

 

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

Label1.ForeColor = Color.Red

End Sub

 

Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged

Label1.ForeColor = Color.Chocolate

End Sub

 

Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged

If CheckBox4.CheckState = CheckState.Checked Then

Label1.Font = New Font(Label1.Font, FontStyle.Underline)

Else

Label1.Font = New Font(Label1.Font, FontStyle.Regular)

End If

‘Label1.Font = New Font(Label1.Font, Label1.Font.Style Or FontStyle.Underline)

End Sub

 

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged

If CheckBox3.CheckState = CheckState.Checked Then

Label1.Font = New Font(Label1.Font, FontStyle.Strikeout)

Else

Label1.Font = New Font(Label1.Font, FontStyle.Regular)

End If

‘Label1.Font = New Font(Label1.Font, Label1.Font.Style Or FontStyle.Strikeout)

End Sub

 

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

If CheckBox1.CheckState = CheckState.Checked Then

Label1.Font = New Font(Label1.Font, FontStyle.Bold)

Else

Label1.Font = New Font(Label1.Font, FontStyle.Regular)

End If

‘Label1.Font = New Font(Label1.Font, Label1.Font.Style Or FontStyle.Bold)

End Sub

 

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged

If CheckBox2.CheckState = CheckState.Checked Then

Label1.Font = New Font(Label1.Font, FontStyle.Italic)

Else

Label1.Font = New Font(Label1.Font, FontStyle.Regular)

End If

‘Label1.Font = New Font(Label1.Font, Label1.Font.Style Or FontStyle.Italic)

End Sub

 

 

End Class

Leave a Reply

Your email address will not be published. Required fields are marked *

eleven + 14 =

Powered by rumahentrepreneur.org