Basic Calculator in Visual Basic .Net

Download
Download is available until [expire_date]
  • Version
  • Download 106
  • File Size 105.40 KB
  • File Count 1
  • Create Date May 6, 2016
  • Last Updated May 6, 2016

Basic Calculator in Visual Basic .Net

Basic Calculator in Visual Basic .Net
Hey guys! This is a basic calculator in vb.net that allows you to get the sum, difference, quotient and product of two numbers
This is also available in vb6 and c#
Open the project solution (.sln) in visual studio 2010/2012 or open directly the project file (.csproj)

Source code:

Public Class Form1

    Sub ValidateEntry()
        If TextBox1.Text = "" And IsNumeric(TextBox1.Text) = True Then
            MessageBox.Show("Please a numeric value")
            TextBox1.Focus()
        ElseIf TextBox2.Text = "" And IsNumeric(TextBox2.Text) = True Then
            MessageBox.Show("Please a numeric value")
            TextBox2.Focus()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ValidateEntry()
        If RadioButton1.Checked = True Then
            MessageBox.Show("the sum is:" & " " & Val(TextBox1.Text) + Val(TextBox2.Text))
        ElseIf RadioButton2.Checked = True Then
            MessageBox.Show("the difference is:" & " " & Val(TextBox1.Text) - Val(TextBox2.Text))
        ElseIf RadioButton3.Checked = True Then
            MessageBox.Show("the quotient is:" & " " & Val(TextBox1.Text) / Val(TextBox2.Text))
        ElseIf RadioButton4.Checked = True Then
            MessageBox.Show("the sum is:" & " " & Val(TextBox1.Text) * Val(TextBox2.Text))
        End If
    End Sub
End Class
, , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.