Jawaban UTS Pemrograman Visual II [VB.Net]

Posted: December 2, 2009 in Info Stikom
Tags: , ,

Sumber Coding : Ugi Dirta

Program terdiri dari dua kategori, Biodata dan Perulangan yang disusun dalam satu Form Utama dan dibuat dengan Prosedur.

Form Utama

Form Utama

Form Utama

Coding :

Public Class Form_Utama

Private Sub Form_Utama_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
”Membuat Form Ini Menjadi MDI Parrent
Me.IsMdiContainer = True
End Sub

Private Sub BiodataToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BiodataToolStripMenuItem.Click
”Menampilkan Form Bioadata
Form1.Show()
End Sub

Private Sub PerulanganToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PerulanganToolStripMenuItem.Click
”Menampilkan Form Perulangan
Form2.Show()
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
”Menutup Form  Utama
Me.Close()
End Sub
End Class

Biodata

Biodata

Biodata

Coding:

Public Class Form1
Sub Hapus()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
End Sub

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

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

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

If Me.TextBox1.Text = “” Then
MsgBox(“Nama Tidak Boleh Kosong”)
Exit Sub
End If

If Me.TextBox2.Text = “” Then
MsgBox(“Alamat idak Boleh Kosong”)
Exit Sub
End If

If Me.TextBox3.Text = “” Then
MsgBox(“Password idak Boleh Kosong”)
Exit Sub
End If

If Me.ComboBox1.Text = “” Then
MsgBox(“Pendidikan idak Boleh Kosong”)
Exit Sub
End If

If RadioButton1.Checked = True Then
JenKel = “Laki-Laki”
Else
JenKel = “Perempuan”
End If

If Me.CheckBox1.Checked = True Then
Verivikasi = “Aktiv”
Else
Verivikasi = “TIDAK AKTIF”
End If

Call Tampil(Me.TextBox1.Text, Me.TextBox2.Text, JenKel, Me.TextBox3.Text, Me.ComboBox1.Text, Verivikasi)

End Sub
End Class

Perulangan

Perulangan

Perulangan

Coding:

Public Class Form2

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
setMdi(Me)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If IsNumeric(TextBox1.Text) = False Then
MsgBox(“Angka  tidak valid !”)
TextBox1.Text = “0”
TextBox1.Focus()
Exit Sub
Else
ListBox1.Items.Clear()
End If
If Val(TextBox1.Text) > 30 Then
MsgBox(“Batas Hanya Sampai 30”)
Exit Sub
End If

TextBox1.Focus()
Call tambah(Val(TextBox1.Text))

End Sub

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

Module

Module Module1
Sub Tampil(ByVal nama As String, ByVal Alamat As String, ByVal jk As String, ByVal pass As String, ByVal pendd As String, ByVal stat As String)
MsgBox(“Nama :” & nama & vbCrLf & “Alamat : ” & Alamat & vbCrLf & “Kelamin : ” & jk & vbCrLf & “Password : ” & pass & vbCrLf & “Pendidikan : ” & pendd & vbCrLf & “Status : ” & stat, MsgBoxStyle.Information)
End Sub
Sub setMdi(ByVal frm As Form)
frm.MdiParent = Form_Utama
End Sub
Const Ngoyong As Integer = 1

Sub tambah(ByVal i As Integer)

For x As Integer = Ngoyong To i
Form2.ListBox1.Items.Add(“Item ke ” & x)
Next
End Sub
End Module

Untuk Program yang sudah jadi silahkan Download Disini

Semoga Bermanfaat

Salam

Hendra Wijaya

Comments
  1. MK says:

    mantaps….

  2. Hendra says:

    To MK…

    Anda yang mantap…

  3. MK says:

    Terima kasih KPK…, kita memang comunity yg paling mantaps..

  4. Hendra says:

    Mk…
    Iya harus dipertahankan…