BELAJAR BAHASA programan

ASSALAMU ALAIKUM WR.WR
OK, Disini yang dibahas adalah Contoh Program Sederhana VB.NET Form Nilai.
langsung aja ke Pokok permasalannya ya.
Pertama, Buka VB.Net sobat, dan reka bentuk form berikut keterangan name nya juga jangan lupa.

Lalu kita Buat Desain Form Seperti Gambar Dibawah !



Lalu double klik form nya,, setelah itu isikan code dibawah ini:


Public Class Form1

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

        npm.Items.Add("12110485")
        npm.Items.Add("12110020")
        npm.Items.Add("11120483")
        npm.Items.Add("10110478")

        kodedosen.Items.Add("KKTI01")
        kodedosen.Items.Add("KKTI02")
        kodedosen.Items.Add("KKTI03")
        kodedosen.Items.Add("KKTI04")

        kdmatakuliah.Items.Add("MT01")
        kdmatakuliah.Items.Add("MT02")
        kdmatakuliah.Items.Add("MT03")
        kdmatakuliah.Items.Add("MT04")



        Dim As Integer
        For i = 10 To 100
            nk.Items.Add (i)
        Next i

        Dim j As Integer
        For j = 10 To 100
            nt.Items.Add (j)
        Next j

        Dim k As Integer
        For k = 10 To 100
            uts . Items.Add (k)
        Next k

        Dim l As Integer
        For l = 10 To 100
            uas.Items.Add (l)
        Next l

    End Sub



Jika sudah,, double klik pada combobox "NPM", isi seperti dibawah ini:

Private Sub npm_SelectedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.SelectedIndexChanged
        Select Case npm.Text
            Case "12110485"
                nama.Text = "dezy Wandrio"
            Case "12110020"
                nama.Text = "Invandri Lubis"
            Case "12020483"
                nama.Text = "Firda auli"
            Case "12030478"
                nama.Text = "Park cu Yoon"

        End Select
        Dim i As String
        i = Microsoft.VisualBasic.Left (npm.Text, 2)
        If i = "12" then
            jenjang.Text = "S1"
            jurusan.Text = "Teknik Informatika"
        ElseIf i = "11" Then
            jenjang.Text = "D3"
            jurusan.Text = "Pengurusan Informatika"
        ElseIf i = "10" Then
            jenjang.Text = " D1 "
            jurusan.Text = "Rangkaian Komunikasi"
        End If
    End Sub



Setelah itu double klik combobox "kod pensyarah",, lalu isikan source code berikut:

 Private Sub kodedosen_SelectedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kodedosen.SelectedIndexChanged
        Select Case kodedosen.Text
            Case "KKTI01"
                nmdosen.Text = "Mesran, M.Kom"
            Case "KKTI02"
                nmdosen.Text = "Ahmad Zakir, St, M.Kom"
            Case "KKTI03"
                nmdosen.Text = " M.Syahrizal, S.Kom, M.Kom "
            Case "KKTI04"
                nmdosen.Text = "Maranata, ST, M.Kom"
        End Select
    End Sub



setelah itu doble klik lagi combobox "Kod mata kuliah",,, lalu isikan code berikut:

Private Sub kdmatakuliah_SelectedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kdmatakuliah.SelectedIndexChanged
        Select Case kdmatakuliah.Text
            Case "MT01"
                matakuliah.Text = "struktur data"
            Case "MT02"
                matakuliah.Text = " pemograman Visual "
            Case "MT03"
                matakuliah.Text = "Komunikasi Data"
            Case "MT04"
                matakuliah.Text = "Seni Bina Dan Organissi"
        End Select
    End Sub


setelah itu double klik button "proses",,,, lalu isikan code berikut:

Private sub btnproses_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        na.Text = 0.1 * nk.Text + 0.15 * nt.Text + 0.3 * uts.Text + 0.45 * uas.Text
        If na . Text> = 80 Then
            nh.Text = "A"
            keterangan.Text = "Lulus"
        ElseIf na.Text> = 70 Then
            nh.Text = "B"
            keterangan.Text = "Lulus"
        ElseIf na.Text> = 60 Then
            nh.Text = "C"
            keterangan.Text = "Lulus"
        ElseIf na.Text> = 50 Then
            nh.Text = "D"
            keterangan.Text = "Gagal"
        Else
            nh.Text = "E"
            keterangan.Text = "Gagal "

        End If
    End Sub


jangan lupa pada button "hapus dan keluar" isi seperti di bawah ini:

Private Sub btnhapus_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        npm.Text = ""
        nama. text = ""
        jurusan.Text = ""
        jenjang.Text = ""
        kodedosen.Text = ""
        nmdosen.Text = ""
        kdmatakuliah.Text = ""
        matakuliah.Text = ""
        nk.Text = ""
        nt.Text = ""
        uts.Text = ""
        uas.Text = ""
        na.Text = ""
        nh.Text = ""
        keterangan.Text = ""

    End Sub

    Private Sub btnkeluar_Click (ByVal sender As System.Object, ByVal e As System. EventArgs) Handles btnkeluar.Click
        End

    End Sub
End Class

hasilnya :


Selamat Mencoba ,,,,