Praktek 4 Pemrograman Visual

Latihan 7 Pemrograman Visual (VB.NET)

Mempelajari Enabled dan Disabled Objek

Coding ….

 

Public Class Form1

Dim hasil As Integer

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

Label1.Text = “Nilai 1” Label2.Text = “Nilai 2” Label3.Text = “Nilai 3” Label4.Text = “Nilai 4” Button1.Text = “Ok” Button2.Text = “Tambah” Button3.Text = “Kurang” Button4.Text = “Kali” Button5.Text = “Bagi” RadioButton1.Text = “Tambah”

RadioButton2.Text = “Kurang” RadioButton3.Text = “Kali” RadioButton4.Text = “Bagi”

‘cara mematikan tombol Button2.Enabled = False Button3.Enabled = False Button4.Enabled = False Button5.Enabled = False

‘cara membuat textboxt tidak bisa diinput

TextBox4.Enabled = False

End Sub

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

MsgBox(“anda akan menghidupkan input textnya “) TextBox4.Enabled = True

End Sub

Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles

RadioButton1.CheckedChanged

Button2.Enabled = True

Button3.Enabled = False Button4.Enabled = False Button5.Enabled = False

End Sub

Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles

RadioButton2.CheckedChanged

Button3.Enabled = True Button2.Enabled = False Button4.Enabled = False Button5.Enabled = False

End Sub

Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles

RadioButton3.CheckedChanged

Button4.Enabled = True Button2.Enabled = False Button3.Enabled = False

Button5.Enabled = False

End Sub

Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles

RadioButton4.CheckedChanged

Button5.Enabled = True Button2.Enabled = False Button3.Enabled = False Button4.Enabled = False

End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click

End Sub

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

MsgBox(“anda akan menjumlahkan nilainya”)

ListBox1.Items.Add(“———Hasil dari Pertambahan adalah————“)

hasil = Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text) + Val(TextBox4.Text) ListBox1.Items.Add(hasil)

End Sub

End Class

Teruuskan Coding diatas sampai selesai ya …..

 

Latihan 8 Struktur Kontrol IF

 Coding  …

 

Public Class Form1

Private Sub ButtonHasil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

ButtonHasil.Click

If radJml.Checked = True Then

TextOutput.Text = Val(TextInput1.Text) + Val(TextInput2.Text) End If

If radmin.Checked = True Then

TextOutput.Text = Val(TextInput1.Text) – Val(TextInput2.Text) End If

If radkali.Checked = True Then

TextOutput.Text = Val(TextInput1.Text) * Val(TextInput2.Text) End If

If radBagi.Checked = True Then

TextOutput.Text = Val(TextInput1.Text) / Val(TextInput2.Text) End If

If radpangkat.Checked = True Then

TextOutput.Text = Math.Pow(Val(TextInput1.Text), _ Val(TextInput2.Text))

End If

End Sub

Private Sub radJml_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radJml.CheckedChanged

Label1.Text = “+” End Sub

Private Sub radmin_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles radmin.CheckedChanged

Label1.Text = “/” End Sub

Private Sub radkali_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles radkali.CheckedChanged

Label1.Text = “x” End Sub

Private Sub radBagi_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles radBagi.CheckedChanged

Label1.Text = “/” End Sub

Private Sub radpangkat_CheckedChanged(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles radpangkat.CheckedChanged

Label1.Text = “^” End Sub

Private Sub TextInput1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextInput1.TextChanged

End Sub

End Class

 

 

Tugas :

 

  1. 1. tuliskan dikertas selembar kegunaan membuat disable objek dan if

 

  1. 2. buatkan saya aplikasi yang mengakomodir semua hal di latihan ini

 

sumber : Afri Yuda, S.Kom.

Cara Daftar Google Adsense Indonesia Agar Cepat Diterima

Google Adsense adalah salah satu program PPC (Pay Per Click) yang paling banyak digemari oleh ...

Learn more
Share This:Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on Pinterest

Leave a Reply

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