Friday, August 20, 2021

Addition of Three Numbers in VB.NET

 Machine Problem


Write a program that will ask the user to gived three numbers, and compute the sum of that numbers.

Use the following formula below.

total_sum = (variable_one + variable_two +variable_three)

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.


My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

' Addition of Three Numbers Using VB.NET

' Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

' www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

' jakerpomperada@gmail.com

' Bacolod City, Negros Occidental Philippines

' May 16, 2021   Sunday  11:23 AM


Public Class Form1

    ' Button Compute

    Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click

        Dim sum As Integer

        Dim a, b, c As String


        sum = 0


        a = txtValue1.Text

        b = txtValue2.Text

        c = txtValue3.Text


        If a = "" Or IsNumeric(a) = False Then

            MessageBox.Show("Please enter a numeric value.")

            txtValue1.Focus()

        ElseIf b = "" Or IsNumeric(b) = False Then

            MessageBox.Show("Please enter a numeric value.")

            txtValue2.Focus()

        ElseIf c = "" Or IsNumeric(c) = False Then

            MessageBox.Show("Please enter a numeric value.")

            txtValue3.Focus()

        Else

            sum = Val(a) + Val(b) + Val(c)

            MessageBox.Show("The sum of " & a & "," & b & ", and " & c & " is " & sum & ".", "The Result")

        End If

    End Sub


    'Button Quit

    Private Sub btnQuit_Click(sender As Object, e As EventArgs) Handles btnQuit.Click

        Dim result = MessageBox.Show(" Are you sure you want to quit the program?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

        If result = DialogResult.Yes Then

            Me.Close()

        Else

            Me.Show()

            txtValue1.Text = ""

            txtValue2.Text = ""

            txtValue3.Text = ""

            txtValue1.Focus()

        End If

    End Sub

    

    'Button Clear

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

        txtValue1.Text = ""

        txtValue2.Text = ""

        txtValue3.Text = ""

        txtValue1.Focus()

    End Sub

End Class


No comments:

Post a Comment