Thursday, July 7, 2016

STUDENT MARKS CALCULATOR

Student Marks Caculator Source Code
Imports System.Text
Public Class Form1
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Application.Exit()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If validateform() Then
            If (chkfailinpaper() > 0) Then

            Else
                getresult()

            End If

        End If
    End Sub
    Public Function validateform() As Boolean
        Dim flag As Boolean = True
        If txtroll.Text.Length = 0 Then
            MsgBox("Enter Roll Number", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txtroll.Focus()
        ElseIf txtname.Text.Length = 0
            MsgBox("Enter Student Name", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txtname.Focus()
        ElseIf txtengmarks.Text.Length = 0
            MsgBox("Enter English Mars", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txtengmarks.Focus()
        ElseIf txthndmarks.Text.Length = 0
            MsgBox("Enter Hindi Marks", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txthndmarks.Focus()
        ElseIf txtmatmarks.Text.Length = 0
            MsgBox("Enter Math Marks", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txtmatmarks.Focus()
        ElseIf txtscimarks.Text.Length = 0
            MsgBox("Enter Science Marks", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txtscimarks.Focus()
        ElseIf txtsst.Text.Length = 0
            MsgBox("Enter S.St Marks", MsgBoxStyle.Critical, "Alert Message")
            flag = False
            txtsst.Focus()
        ElseIf Not (IsNumeric(txtengmarks.Text))
            MsgBox("Enter Only Numeric Value", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtengmarks.Clear()
            txtengmarks.Focus()
        ElseIf Not (IsNumeric(txthndmarks.Text))
            MsgBox("Enter Only Numeric Value", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txthndmarks.Clear()
            txthndmarks.Focus()
        ElseIf Not (IsNumeric(txtmatmarks.Text))
            MsgBox("Enter Only Numeric Value", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtmatmarks.Clear()
            txtmatmarks.Focus()
        ElseIf Not (IsNumeric(txtscimarks.Text))
            MsgBox("Enter Only Numeric Value", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtscimarks.Clear()
            txtscimarks.Focus()
        ElseIf Not (IsNumeric(txtsst.Text))
            MsgBox("Enter Only Numeric Value", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtsst.Clear()
            txtsst.Focus()
        ElseIf Integer.Parse(txtengmarks.Text) < 0 Or Integer.Parse(txtengmarks.Text) > 100
            MsgBox("Enter Value Between 0 to 100", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtengmarks.Clear()
            txtengmarks.Focus()
        ElseIf Integer.Parse(txthndmarks.Text) < 0 Or Integer.Parse(txthndmarks.Text) > 100
            MsgBox("Enter Value Between 0 to 100", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txthndmarks.Clear()
            txthndmarks.Focus()
        ElseIf Integer.Parse(txtmatmarks.Text) < 0 Or Integer.Parse(txtmatmarks.Text) > 100
            MsgBox("Enter Value Between 0 to 100", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtmatmarks.Clear()
            txtmatmarks.Focus()
        ElseIf Integer.Parse(txtscimarks.Text) < 0 Or Integer.Parse(txtscimarks.Text) > 100
            MsgBox("Enter Value Between 0 to 100", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtscimarks.Clear()
            txtscimarks.Focus()
        ElseIf Integer.Parse(txtsst.Text) < 0 Or Integer.Parse(txtsst.Text) > 100
            MsgBox("Enter Value Between 0 to 100", MsgBoxStyle.Information, "Alert Message")
            flag = False
            txtsst.Clear()
            txtsst.Focus()
        End If
        Return flag
    End Function
    Public Sub getresult()
        Dim subject(5) As Double
        Dim tmarks, per As Double
        Dim grade As String = String.Empty
        subject(0) = Double.Parse(txtengmarks.Text)
        subject(1) = Double.Parse(txthndmarks.Text)
        subject(2) = Double.Parse(txtmatmarks.Text)
        subject(3) = Double.Parse(txtscimarks.Text)
        subject(4) = Double.Parse(txtsst.Text)

        For counter As Integer = 0 To 4
            tmarks = tmarks + subject(counter)
        Next

        per = tmarks / 5

        If per >= 60 Then
            grade = "A"c
        ElseIf per >= 45
            grade = "B"c
        ElseIf per >= 30
            grade = "C"c
        End If

        txtgrade.Text = grade
        txtper.Text = per.ToString
        totalmarks.Text = tmarks.ToString

    End Sub
    Public Function chkfailinpaper() As Integer
        Dim subject(5) As Double
        Dim strfailpaper As New StringBuilder
        Dim subname() As String = {"English", "Hindi", "Math", "Science", "S.St"}
        Dim countfailpaper As Integer = 0
        subject(0) = Double.Parse(txtengmarks.Text)
        subject(1) = Double.Parse(txthndmarks.Text)
        subject(2) = Double.Parse(txtmatmarks.Text)
        subject(3) = Double.Parse(txtscimarks.Text)
        subject(4) = Double.Parse(txtsst.Text)

        For counter As Integer = 0 To 4
            If subject(counter) < 30 Then
                strfailpaper.Append(subname(counter) & ",")
                countfailpaper = countfailpaper + 1
            End If
        Next
        If (countfailpaper > 0) Then
            clrres()
            MsgBox(strfailpaper.ToString, MsgBoxStyle.Critical, "Fail")
        End If
        Return countfailpaper
    End Function
    Public Sub clrres()
        txtgrade.Clear()
        txtper.Clear()
        totalmarks.Clear()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        clearall()
    End Sub
    Public Sub clearall()
        txtroll.Clear()
        txtname.Clear()
        txtengmarks.Clear()
        txthndmarks.Clear()
        txtmatmarks.Clear()
        txtscimarks.Clear()
        txtsst.Clear()
        txtgrade.Clear()
        txtper.Clear()
        totalmarks.Clear()
        txtroll.Focus()
    End Sub

    Private Sub txtroll_TextChanged(sender As Object, e As EventArgs) Handles txtroll.TextChanged

    End Sub

    Private Sub txtroll_MouseHover(sender As Object, e As EventArgs) Handles txtroll.MouseHover
        ToolTip1.SetToolTip(txtroll, "Enter Roll Number")
    End Sub
    Private Sub txtname_MouseHover(sender As Object, e As EventArgs) Handles txtname.MouseHover
        ToolTip1.SetToolTip(txtname, "Enter Student Name")
    End Sub

    Private Sub dtpdob_MouseHover(sender As Object, e As EventArgs) Handles dtpdob.MouseHover
        ToolTip1.SetToolTip(dtpdob, "Select Date Of Birth")
    End Sub
    Private Sub txtengmarks_MouseHover(sender As Object, e As EventArgs) Handles txtengmarks.MouseHover
        ToolTip1.SetToolTip(txtengmarks, "Enter English Marks")
    End Sub
    Private Sub txthndmarks_MouseHover(sender As Object, e As EventArgs) Handles txthndmarks.MouseHover
        ToolTip1.SetToolTip(txthndmarks, "Enter Hindi Marks")
    End Sub
    Private Sub txtmatmarks_MouseHover(sender As Object, e As EventArgs) Handles txtmatmarks.MouseHover
        ToolTip1.SetToolTip(txtmatmarks, "Enter Math Marks")
    End Sub
    Private Sub txtscimarks_MouseHover(sender As Object, e As EventArgs) Handles txtscimarks.MouseHover
        ToolTip1.SetToolTip(txtscimarks, "Enter Science Marks")
    End Sub
    Private Sub txtsst_MouseHover(sender As Object, e As EventArgs) Handles txtsst.MouseHover
        ToolTip1.SetToolTip(txtsst, "Enter Social Science Marks")
    End Sub
End Class

.................................................................................................................................................................
Click Here To Download Student Marks Calculator Application

Tuesday, July 5, 2016

Sunday, July 3, 2016

Calculate Rupee Program In Vb.Net

Calculate Rupee Program Source Code
Public Class frmcalrupess
    Private Sub btncalrup_Click(sender As Object, e As EventArgs) Handles btncalrup.Click
        If txtrupess.Text.Length = 0 Then
            MsgBox("Enter Rupess", MsgBoxStyle.Critical, "Alert Message")
            txtrupess.Focus()
            reini()
            rmvhighlight()
            Return
        ElseIf Not IsNumeric(txtrupess.Text) Then
            MsgBox("Enter Only Numeric Value", MsgBoxStyle.Critical, "Alert Message")
            txtrupess.Clear()
            txtrupess.Focus()
            reini()
            rmvhighlight()
            Return
        ElseIf Integer.Parse(txtrupess.Text) = 0 Then
            MsgBox("Enter Rupees is greater than zero", MsgBoxStyle.Critical, "Alert Message")
            txtrupess.Clear()
            txtrupess.Focus()
            reini()
            rmvhighlight()
            Return
        ElseIf Integer.Parse(txtrupess.Text) < 0 Then
            MsgBox("Enter only postive value", MsgBoxStyle.Critical, "Alert Message")
            txtrupess.Clear()
            txtrupess.Focus()
            reini()
            rmvhighlight()
            Return
        End If
        calrup()
    End Sub
    Public Sub calrup()
        Try
            Dim non() As Integer = {1000, 500, 100, 50, 20, 10, 5, 2, 1}

            Dim min, strresrup, tnon As Double
            tnon = 0
            strresrup = Math.Round(Double.Parse(txtrupess.Text), 0)
            txtrupess.Text = strresrup.ToString
            min = strresrup
            While strresrup <> 0
                For counter As Integer = 0 To non.Length - 1
                    If (non(counter) <= min) Then
                        strresrup = strresrup - non(counter)
                        tnon = tnon + 1
                        Exit For
                    End If
                Next
                min = strresrup
            End While


            Dim strnon(tnon - 1) As Integer

            tnon = 0
            strresrup = Math.Round(Double.Parse(txtrupess.Text), 0)

            min = strresrup
            While strresrup <> 0
                For counter As Integer = 0 To non.Length - 1
                    If (non(counter) <= min) Then
                        strnon(tnon) = non(counter)
                        strresrup = strresrup - non(counter)
                        tnon = tnon + 1
                        Exit For
                    End If
                Next
                min = strresrup
            End While

            reini()
            For counter As Integer = 0 To tnon - 1
                If (strnon(counter) = 1000) Then
                    txtthousand.Text = Integer.Parse(txtthousand.Text) + 1
                ElseIf (strnon(counter) = 500) Then
                    txtfhun.Text = Integer.Parse(txtfhun.Text) + 1
                ElseIf (strnon(counter) = 100) Then
                    txthun.Text = Integer.Parse(txthun.Text) + 1
                ElseIf (strnon(counter) = 50) Then
                    txtfifty.Text = Integer.Parse(txtfifty.Text) + 1
                ElseIf (strnon(counter) = 20) Then
                    txttwenty.Text = Integer.Parse(txttwenty.Text) + 1
                ElseIf (strnon(counter) = 10) Then
                    txtten.Text = Integer.Parse(txtten.Text) + 1
                ElseIf (strnon(counter) = 5) Then
                    txtfive.Text = Integer.Parse(txtfive.Text) + 1
                ElseIf (strnon(counter) = 2) Then
                    txttwo.Text = Integer.Parse(txttwo.Text) + 1
                ElseIf (strnon(counter) = 1) Then
                    txtone.Text = Integer.Parse(txtone.Text) + 1
                End If
            Next
            highlight()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub reini()
        txtthousand.Text = "0"
        txtfhun.Text = "0"
        txthun.Text = "0"
        txtfifty.Text = "0"
        txttwenty.Text = "0"
        txtten.Text = "0"
        txtfive.Text = "0"
        txttwo.Text = "0"
        txtone.Text = "0"
    End Sub
    Public Sub highlight()
        If Integer.Parse(txtthousand.Text) > 0 Then
            txtthousand.BackColor = Color.Blue
            txtthousand.ForeColor = Color.White
        Else
            txtthousand.BackColor = Color.White
        End If
        If Integer.Parse(txtfhun.Text) > 0 Then
            txtfhun.BackColor = Color.Blue
            txtfhun.ForeColor = Color.White
        Else
            txtfhun.BackColor = Color.White
        End If
        If Integer.Parse(txthun.Text) > 0 Then
            txthun.BackColor = Color.Blue
            txthun.ForeColor = Color.White
        Else
            txthun.BackColor = Color.White
        End If
        If Integer.Parse(txtfifty.Text) > 0 Then
            txtfifty.BackColor = Color.Blue
            txtfifty.ForeColor = Color.White
        Else
            txtfifty.BackColor = Color.White
        End If
        If Integer.Parse(txttwenty.Text) > 0 Then
            txttwenty.BackColor = Color.Blue
            txttwenty.ForeColor = Color.White
        Else
            txttwenty.BackColor = Color.White
        End If
        If Integer.Parse(txtten.Text) > 0 Then
            txtten.BackColor = Color.Blue
            txtten.ForeColor = Color.White
        Else
            txtten.BackColor = Color.White
        End If
        If Integer.Parse(txtfive.Text) > 0 Then
            txtfive.BackColor = Color.Blue
            txtfive.ForeColor = Color.White
        Else
            txtfive.BackColor = Color.White
        End If
        If Integer.Parse(txttwo.Text) > 0 Then
            txttwo.BackColor = Color.Blue
            txttwo.ForeColor = Color.White
        Else
            txttwo.BackColor = Color.White
        End If
        If Integer.Parse(txtone.Text) > 0 Then
            txtone.BackColor = Color.Blue
            txtone.ForeColor = Color.White
        Else
            txtone.BackColor = Color.White
        End If
    End Sub
    Public Sub rmvhighlight()

        txtthousand.BackColor = Color.White
        txtthousand.ForeColor = Color.Black


        txtfhun.BackColor = Color.White
        txtfhun.ForeColor = Color.Black



        txthun.BackColor = Color.White
        txthun.ForeColor = Color.Black


        txtfifty.BackColor = Color.White
        txtfifty.ForeColor = Color.Black
       

        txttwenty.BackColor = Color.White
        txttwenty.ForeColor = Color.Black
       

        txtten.BackColor = Color.White
        txtten.ForeColor = Color.Black
       

        txtfive.BackColor = Color.White
        txtfive.ForeColor = Color.Black
       

        txttwo.BackColor = Color.White
        txttwo.ForeColor = Color.Black
       

        txtone.BackColor = Color.White
        txtone.ForeColor = Color.Black
       
    End Sub

    Private Sub frmcalrupess_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class

Click Here To Download Output File For Calculate Rupee Program