Tuesday, May 15, 2018

Addition And Product of Two Numbers in Visual Basic NET

Here is a program that will ask the user to give two numbers and then our program will compute the sum and product of the two number being provided by our user using Visual Basic NET.

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

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.





Sample Program Output



Program Listing

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim a As Integer
        Dim b As Integer
        Dim sum As Integer
        Dim product As Integer

        a = CInt(Me.TextBox1.Text)
        b = CInt(Me.TextBox2.Text)

        sum = (a + b)

        product = (a * b)


        Label4.Text = "The sum of " & a & " and " & b & " is  " & sum & "."
        Label5.Text = "The product of " & a & " and " & b & " is  " & product & "."
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Label4.Text = ""
        Label5.Text = ""
        Me.TextBox1.Text = ""
        Me.TextBox2.Text = ""
        Me.TextBox1.Focus()
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim n As String = MsgBox("Do you really want to exit?", MsgBoxStyle.YesNo, "Quit Program?")
        If n = vbYes Then
            Me.Close()
        Else
            Me.Show()
            Label4.Text = ""
            Label5.Text = ""
            Me.TextBox1.Text = ""
            Me.TextBox2.Text = ""
            Me.TextBox1.Focus()
        End If
    End Sub
End Class

No comments:

Post a Comment