Nothing Special   »   [go: up one dir, main page]

Nama: Tri Hardiana Siregar NPM:0814370299: Praktek 1. Desaign Form

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 9

Nama: Tri Hardiana Siregar

NPM:0814370299

Praktek 1.

Desaign Form:

Source code Program:

Public Class Form1


Dim a, b As Long
Dim c As Single
Dim response As ValidationConstraints

Private Sub cmdbagi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdbagi.Click


a = Val(txtnilaia.Text)
b = Val(txtnilaib.Text)
If a = 0 And b = 0 Then
response = MsgBox("Nilai A dan B tidak Boleh 0", 0, "Input Nilai A,B")
Exit Sub
End If
c=a/b
txthasilproses.Text = Str(c)
End Sub

Private Sub cmdexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.Click


End
End Sub

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


cmdkali.Click
a = Val(txtnilaia.Text)
b = Val(txtnilaib.Text)
If a = 0 And b = 0 Then
response = MsgBox("Nilai A dan B tidak Boleh 0", 0, "Input Nilai A,B")
Exit Sub
End If
c=a*b
txthasilproses.Text = Str(c)
End Sub

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


cmdkurang.Click
a = Val(txtnilaia.Text)
b = Val(txtnilaib.Text)
If a = 0 And b = 0 Then
response = MsgBox("Nilai A dan B tidak Boleh 0", 0, "Input Nilai A,B")
Exit Sub
End If
c=a-b
txthasilproses.Text = Str(c)
End Sub

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


cmdtambah.Click
a = Val(txtnilaia.Text)
b = Val(txtnilaib.Text)
If a = 0 And b = 0 Then
response = MsgBox("Nilai A dan B tidak Boleh 0", 0, "Input Nilai A,B")
Exit Sub
End If
c=a+b
txthasilproses.Text = Str(c)
End Sub

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


cmdpangkat.Click
a = Val(txtnilaia.Text)
b = Val(txtnilaib.Text)
If a = 0 And b = 0 Then
response = MsgBox("Nilai A dan B tidak Boleh 0", 0, "Input Nilai A,B")
Exit Sub
End If
c=a^b
txthasilproses.Text = Str(c)
End Sub
End Class

Executi Program:
Praktek 2.

Desaign Form:

Source code Program:

Public Class Form1

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


System.EventArgs) Handles cmdclose.Click
End
End Sub

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


System.EventArgs) Handles cmdtambahstring.Click
Dim a, b, hitung As String
a = Val(txta.Text)
b = Val(txtb.Text)
hitung = a + b
txthasilstring.Text = hitung
End Sub

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


System.EventArgs) Handles cmdtambahdouble.Click
Dim a, b, hitung1 As Double
a = Val(txta.Text)
b = Val(txtb.Text)
hitung1 = a + b
txthasildouble.Text = Str(hitung1)
End Sub

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


System.EventArgs) Handles cmdtambahint.Click
Dim a, b, hitung2 As Integer
a = Val(txta.Text)
b = Val(txtb.Text)
hitung2 = a + b
txthasilint.Text = Str(hitung2)
End Sub
End Class

Executi Program:
Praktek 3.

Desaign Form:

Source code Program:

Public Class Form1

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


Handles MyBase.Load
Dim i As Integer
For i = 1 To 10
List1.Items(i) = (i * 10) + 10
Next i
End Sub

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


System.EventArgs) Handles List1.SelectedIndexChanged

End Sub

Private Sub Text2_Keypress(ByVal keyascii As Integer)

If keyascii = 13 Then
Text1.Text = List1.Items(List1.SelectedIndex)
Text2.Text = List1.Items(List1.SelectedIndex)
End If
End Sub

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


System.EventArgs) Handles Button1.Click
Dim i As Integer
For i = 0 To 10
List1.Items(i) = i * 10 + 10
Next i
End Sub
End Class
Executi Program:

Praktek 4.

Desaign Form:
Source code Program:

Public Class Form1

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


System.EventArgs) Handles Combo1.SelectedIndexChanged
Dim rupiah As Double
If Combo1.Text = "Dollar US" Then
Text3.Text = Format(9600, "#,###")
ElseIf Combo1.Text = "Dollar AUS" Then
Text3.Text = Format(3500, "#,###")
ElseIf Combo1.Text = "Yen Jepang" Then
Text3.Text = Format(3200, "#,###")
ElseIf Combo1.Text = "Pound Inggris" Then
Text3.Text = Format(4500, "#,###")
ElseIf Combo1.Text = "Won Korea" Then
Text3.Text = Format(5000, "#,###")
End If
rupiah = (Text1.Text * Text3.Text)
Text2.Text = Format(rupiah, "###,###,###.#0")
End Sub

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


Handles MyBase.Load

End Sub

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


System.EventArgs) Handles Button1.Click
End
End Sub
End Class

Executi Program:
Praktek 5.

Desaign Form:

Source code Program:

Public Class Form1

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


System.EventArgs) Handles cmdmulai.Click
text1.Text = ""
text2.Text = ""
text3.Text = ""
text4.Text = ""
text5.Text = ""
text6.Text = ""
End Sub

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


System.EventArgs) Handles cmdselesai.Click
End
End Sub

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


System.EventArgs) Handles opttidak.CheckedChanged
Dim nilai As Double
nilai = Val(text4.Text) * Val(text3.Text)
text5.Text = Format(nilai, "#,###")
End Sub

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


System.EventArgs) Handles optya.CheckedChanged
Dim nilai, nilai1 As Double
nilai = Val(text4.Text) * Val(text3.Text)
text5.Text = Format(nilai, "#,###")
If optya.Checked Then
nilai1 = 0.1 * nilai
text6.Text = Format(nilai1, "#,###")
Else
text6.Text = 0
End If
text7.Text = Format(nilai - nilai1, "#,###")
End Sub

End Class

Executi Program:

You might also like