Laman

Minggu, 06 Juli 2014

Program perhitungan nilai akhir dan progress bar VB.NET

aplikasi vb.net nilai akhir dengan tool box label, group box, progress bar, button beserta validasi nya....



Source Code :

Public Class Form1

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Dim x As Char
        x = e.KeyChar
        If x = Chr(13) Then
            'validasi kosong
            If TextBox1.Text = "" Then
                MsgBox("Jangan dikosongkan donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                Exit Sub
            End If
            'validasi angka
            If Not IsNumeric(TextBox1.Text) Then
                MsgBox("Isi dengan angka donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox1.Text = ""
                Exit Sub
            End If
            TextBox1.Enabled = False
            TextBox2.Enabled = True
            Button2.Enabled = True
            TextBox2.Focus()
        End If
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        Dim x As Char
        x = e.KeyChar
        If x = Chr(13) Then
            'validasi kosong
            If TextBox2.Text = "" Then
                MsgBox("Jangan dikosongkan donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                Exit Sub
            End If
            'validasi angka
            If IsNumeric(TextBox2.Text) Then
                MsgBox("Masa nama pake angka? pake huruf donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox2.Text = ""
                Exit Sub
            End If
            TextBox2.Enabled = False
            TextBox3.Enabled = True
            TextBox3.Focus()
        End If
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub

    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
        Dim x As Char
        x = e.KeyChar
        If x = Chr(13) Then
            'validasi kosong
            If TextBox3.Text = "" Then
                MsgBox("Jangan dikosongkan donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                Exit Sub
            End If
            'validasi angka, minus dan batas max
            If Not IsNumeric(TextBox3.Text) Then
                MsgBox("Isi dengan angka donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox3.Text = ""
                Exit Sub
            ElseIf TextBox3.Text > 100 Then
                MsgBox("Batas Maximum sampai 100....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox3.Text = ""
                Exit Sub
            ElseIf TextBox3.Text < 0 Then
                MsgBox("Tidak Boleh Minus....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox3.Text = ""
                Exit Sub
            End If
            TextBox3.Enabled = False
            TextBox4.Enabled = True
            TextBox4.Focus()
        End If
    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged

    End Sub

    Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
        Dim x As Char
        x = e.KeyChar
        If x = Chr(13) Then
            'validasi kosong
            If TextBox4.Text = "" Then
                MsgBox("Jangan dikosongkan donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                Exit Sub
            End If
            'validasi angka
            If Not IsNumeric(TextBox4.Text) Then
                MsgBox("Isi dengan angka donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox4.Text = ""
                Exit Sub
            ElseIf TextBox4.Text > 100 Then
                MsgBox("Batas Maximum sampai 100....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox4.Text = ""
                Exit Sub
            ElseIf TextBox4.Text < 0 Then
                MsgBox("Tidak Boleh Minus....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox4.Text = ""
                Exit Sub
            End If
            TextBox4.Enabled = False
            TextBox5.Enabled = True
            TextBox5.Focus()
        End If
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged

    End Sub

    Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
        Dim x As Char
        x = e.KeyChar
        If x = Chr(13) Then
            'validasi kosong
            If TextBox5.Text = "" Then
                MsgBox("Jangan dikosongkan donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                Exit Sub
            End If
            'validasi angka
            If Not IsNumeric(TextBox5.Text) Then
                MsgBox("Isi dengan angka donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox5.Text = ""
                Exit Sub
            ElseIf TextBox5.Text > 100 Then
                MsgBox("Batas Maximum sampai 100....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox5.Text = ""
                Exit Sub
            ElseIf TextBox5.Text < 0 Then
                MsgBox("Tidak Boleh Minus....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox5.Text = ""
                Exit Sub
            End If
            TextBox5.Enabled = False
            TextBox6.Enabled = True

            TextBox6.Focus()
        End If
    End Sub

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

    End Sub

    Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
        Dim x As Char
        x = e.KeyChar
        If x = Chr(13) Then
            'validasi kosong
            If TextBox6.Text = "" Then
                MsgBox("Jangan dikosongkan donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                Exit Sub
            End If
            'validasi angka
            If Not IsNumeric(TextBox6.Text) Then
                MsgBox("Isi dengan angka donk cin....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox6.Text = ""
                Exit Sub
            ElseIf TextBox6.Text > 16 Then
                MsgBox("Batas Maximum sampai 16....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox6.Text = ""
                Exit Sub
            ElseIf TextBox6.Text < 0 Then
                MsgBox("Tidak Boleh Minus....!!", MsgBoxStyle.Critical, "Oh Tidak Bisa")
                TextBox6.Text = ""
                Exit Sub
            End If
            TextBox6.Enabled = False
            Button3.Enabled = True
            Button3.Focus()
        End If
    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged

    End Sub

    Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label12.Click

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim uas, uts, tgs, abs, na As Double
        Dim ket, grade As String
        Dim i As Integer
        For i = 1 To 10000
            ProgressBar1.Value = i
        Next i
        uas = TextBox3.Text
        uts = TextBox4.Text
        tgs = TextBox5.Text
        abs = TextBox6.Text


        uas = (50 * uas) / 100
        uts = (30 * uts) / 100
        tgs = (10 * tgs) / 100
        abs = ((abs * 100) / 16) * 0.1
        na = uas + uts + tgs + abs

        If na >= 60 Then
            ket = "LULUS"
        End If

        If na >= 85 Then
            grade = "A"
        ElseIf na >= 75 And na < 85 Then
            grade = "B"
        ElseIf na >= 60 And na < 75 Then
            grade = "C"
        ElseIf na >= 50 And na < 60 Then
            grade = "D"
            ket = "Mengulang Semester Depan"
        ElseIf na < 50 Then
            grade = "E"
            ket = "Kuliah Semester Depan"
        End If

        Label14.Text = grade
        Label12.Text = na
        Label15.Text = ket
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Focus()
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        Label14.Text = ""
        Label12.Text = ""
        Label15.Text = ""
        TextBox2.Enabled = False
        TextBox3.Enabled = False
        TextBox4.Enabled = False
        TextBox5.Enabled = False
        TextBox6.Enabled = False
        Button2.Enabled = False
        Button3.Enabled = False
        TextBox1.Enabled = True
        TextBox1.Focus()
    End Sub

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

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox2.Enabled = False
        TextBox3.Enabled = False
        TextBox4.Enabled = False
        TextBox5.Enabled = False
        TextBox6.Enabled = False
      
        Button2.Enabled = False
        Button3.Enabled = False
    End Sub

    Private Sub Button3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button3.MouseMove
        Button3.BackColor = Color.Red
    End Sub

    Private Sub GroupBox5_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox5.Enter

    End Sub

    Private Sub GroupBox5_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox5.MouseMove
        Button3.BackColor = Color.Silver
        Button2.BackColor = Color.Silver
        Button1.BackColor = Color.Silver
    End Sub

    Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseMove
        Button2.BackColor = Color.Red
    End Sub

    Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
        Button1.BackColor = Color.Violet
    End Sub

    Private Sub Label19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label19.Click
        Form2.ShowDialog()
    End Sub

    Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click

    End Sub
End Class

Download aplikasi "Coming Soon"
Download Master Source Code "Coming Soon"
Thank You ^^........

Tidak ada komentar :

Posting Komentar