Create Calculator With Visual Studio 2012 | VB.Net Calculator
picture : if text field is null
How to create Simple Calculator with visual studio 2012 or VB.Net? This is your solution, you can read this tutorial, you also can Download Source Code Simple Calculator with visual studio 2012, and direct practice this tutorial.
- Open Visual Studio,
- New Project then, create design like this picture :
3. Right Click or F7 to view Source Code,
4. Write code like this :
Public Class Calculator Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim A = varA.Text Dim B = varB.Text If (A = "") Then warn.Text = "var A Not Allow null" ElseIf (B = "") Then warn.Text = "var B Not Allow null" Else Dim c = A * B Operation.Text = "X" Result.Text = c End If End Sub Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click Close() End Sub Private Sub divided_Click(sender As Object, e As EventArgs) Handles divided.Click Dim A = varA.Text Dim B = varB.Text If (A = "") Then warn.Text = "var A Not Allow null" ElseIf (B = "") Then warn.Text = "var B Not Allow null" Else Dim c = A / B Operation.Text = ":" Result.Text = c End If End Sub Private Sub minus_Click(sender As Object, e As EventArgs) Handles minus.Click Dim A = varA.Text Dim B = varB.Text If (A = "") Then warn.Text = "var A Not Allow null" ElseIf (B = "") Then warn.Text = "var B Not Allow null" Else Dim c = A - B Operation.Text = "-" Result.Text = c End If End Sub Private Sub plus_Click(sender As Object, e As EventArgs) Handles plus.Click Dim A = varA.Text Dim B = varB.Text If (A = "") Then warn.Text = "var A Not Allow null" ElseIf (B = "") Then warn.Text = "var B Not Allow null" Else Dim c = Int(A) + Int(B) Operation.Text = "+" Result.Text = c End If End Sub Private Sub clear_Click(sender As Object, e As EventArgs) Handles clear.Click varA.Text = "" varB.Text = "" Operation.Text = "Operation" Result.Text = "" warn.Text = "" End Sub End Class
5. Start
6. Good Luck
Tutorial Calculator with visual studio 2012 as pdf (366 KB)
Source Code Calculator with visual studio 2012 (41 KB)
Aplication Calculator with visual studio 2012 (41 KB)
Comments
Post a Comment