How to create a calculator in Visual Basic.

Step 1 :  Start Visual Basic by,


  • Click Start ---> All programs ---> Microsoft Visual Studio 2010 Express ---> Microsoft Visual Basic 2010 Express.

  • The start page of the Microsoft Visual Basic 2010 Express appears. It consists of these sections.

  1. New Project / Open Project
  2. Recent Project
  3. Get Started Pane: Has useful tips to develop an application quickly.
  4. Latest News Pane: News about new releases and updates from Microsoft.

  •  To create an application , click on the "New Project". The new project window appears. At the bottom of this window, change the default project name Windows Application 1 to a more meaningful name, and click OK.

  • The Integrated Environment window appears.

 Step 2:  Drag 3 text boxes, 3 labels, and 4 buttons from the toolbox and arrange then as shown,


Step 3:
  • Then double click on the "add" button and type ,

Public Class Form1
Private Sub Button1_Click(By Val sender As System. Object, By Val e As System.EventArgs ) Handles Button1.Click
Dim A,B,C As Integer
A = Val(TextBox1.Text)
B = Val(TextBox2.Text)
C = A + b
tetxbox3.text = c
End Sub
  • Then double click on "Subtract" button and type,

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim A,B,C As Integer
A = Val(TextBox1.Text)
B = Val(TextBox2.Text)
C = A - b
tetxbox3.text = c
End Sub

  • Then double click on "Multiply" button and type,

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim A,B,C As Integer
A = Val(TextBox1.Text)
B = Val(TextBox2.Text)
C = A * b
tetxbox3.text = c
End Sub

  • Then double click on "Divide" button and type,

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim A,B,C As Integer
A = Val(TextBox1.Text)
B = Val(TextBox2.Text)
C = A / b
tetxbox3.text = c
End Sub
End Class


https://www.youtube.com/watch?v=LaY5BdeSN5k

Comments

Popular posts from this blog

Introduction to Software.

How to install Camptasia 9 on Windows 10.