Jumat, 04 Maret 2011

Project Visual Basic 1

postingan ini dibuat dalam rangka memenuhi tugas vb. Saya membuat program sederhana untuk menghitung nilai akhir mahasiswa.

form1 sebelum coding
gambar 1 di atas menunjukkan form mahasiswa


form2 sebelum coding

gambar 2 di atas menunjukkan pilihan mahasiswa lulus atau tidak lulus

form 1 setelah coding masukkan data mahasiswa



coding

Public Class Form1

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

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

TextBox4.Text = ""

TextBox5.Text = ""

TextBox6.Text = ""

TextBox1.Focus()

End Sub

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

'Proses Nilai Akhir

If Not Len(TextBox3.Text) = 0 And Not Len(TextBox4.Text) = 0 Then

TextBox5.Text = (TextBox3.Text * 0.5) + (TextBox4.Text * 0.5)

If TextBox5.Text >= 65 Then

TextBox6.Text = "Lulus"

Else

TextBox6.Text = "Tidak Lulus"

End If

Else

MsgBox("Data tidak boleh kosong")

End If

End Sub

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

'Proses Keterangan

If Not Len(TextBox5.Text) = 0 Then

If TextBox5.Text >= 65 Then

TextBox6.Text = "Lulus"

Else

TextBox6.Text = "Tidak Lulus"

End If

'proses Grade

If TextBox5.Text >= 85 Then

Else

If TextBox5.Text >= 75 Then

Else

If TextBox5.Text >= 65 Then

Else

If TextBox5.Text >= 55 Then

Else

End If

End If

End If

End If

End If

End Sub


jika ingin keluar akan akan tampil form seperti di bawah ini


coding

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim X As Integer

X = MsgBox("YAKIN KELUAR..?", MsgBoxStyle.YesNo + MsgBoxStyle.Question)

If X = vbYes Then

Me.Close()

End If

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

form2.show()

End Sub

End Class



jika pilih next maka akan berlanjut ke form 2, yang menunjukkan bahwa mahasiswa lulus.


coding

Public Class Form2

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

If CheckBox1.Checked = True Then

PictureBox1.Visible = True

Else

PictureBox1.Visible = False

End If

End Sub

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

If CheckBox2.Checked = True Then

PictureBox2.Visible = True

Else

PictureBox2.Visible = False

End If

End Sub

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

form3.show()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim X As Integer

X = MsgBox("YAKIN KELUAR..?", MsgBoxStyle.YesNo + MsgBoxStyle.Question)

If X = vbYes Then

Me.Close()

End If

End Sub

End Class



Tidak ada komentar:

Posting Komentar