Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Calculator
Author:
Divya M
E-mail:
Click to e-mail author
Submitted:
1/17/2011
Version:
VB 2005
Compatibility:
VB 2005, VB 2008, VB 2010
Category:
Mathematics
Views:
10431
Simple calculator creation using vb.net 2005 adding 2 numbers and displaying result in a text box...
Declarations:
Steps For Creation:- ==================== 1. Open new project and rename it as calculator. 2. Place 3 labels for a value, b value and answer. 3. Place 3 text boxes and 6 buttons. 4. Rename all buttons as addition, subtraction, multiplication, division, clear, exit. 5. Click on each button to write code given below. 6. Save all and run the project. 7. Give values in a value text box and b value text box. 8. Click on addition button this will display the answer in the answer text box. 9. Same as put values and click on each button. 10. Clear button clears previous values and exit button exits from the run window.
Code:
Public Class Form1 Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim a, b, c As Integer a = txtCalc1.Text b = txtCalc2.Text c = a + b txtAns.Text = c End Sub Private Sub btnSub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSub.Click Dim a, b, c As Integer a = txtCalc1.Text b = txtCalc2.Text c = a - b txtAns.Text = c End Sub Private Sub btnMul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMul.Click Dim a, b, c As Integer a = txtCalc1.Text b = txtCalc2.Text c = a * b txtAns.Text = c End Sub Private Sub btnDiv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDiv.Click Dim a, b, c As Integer a = txtCalc1.Text b = txtCalc2.Text c = a / b txtAns.Text = c End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click txtCalc1.Text = " " txtCalc2.Text = " " txtAns.Text = " " End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start("calc") End Sub End Class
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement