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
All In One Calulator
Author:
Ahmed Adel
E-mail:
Click to e-mail author
Submitted:
1/15/2017
Version:
VB 2005
Compatibility:
VB 2005, VB 2008, VB 2010, VB 2012, VB 2015
Category:
Mathematics
Views:
7954
Complete code for all in one calculator.
Declarations:
Public Class Form1 Dim firstnumber As Long Dim operation As String
Code:
Private Sub n1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n1.Click LCD.Text = LCD.Text & "1" End Sub Private Sub n2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n2.Click LCD.Text = LCD.Text & "2" End Sub Private Sub n3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n3.Click LCD.Text = LCD.Text & "3" End Sub Private Sub n4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n4.Click LCD.Text = LCD.Text & "4" End Sub Private Sub n5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n5.Click LCD.Text = LCD.Text & "5" End Sub Private Sub n6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n6.Click LCD.Text = LCD.Text & "6" End Sub Private Sub n7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n7.Click LCD.Text = LCD.Text & "7" End Sub Private Sub n8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n8.Click LCD.Text = LCD.Text & "8" End Sub Private Sub n9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n9.Click LCD.Text = LCD.Text & "9" End Sub Private Sub n0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n0.Click LCD.Text = LCD.Text & "0" End Sub Private Sub bc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bc.Click LCD.Text = "0" End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bequal.Click Dim secondnumber As Long Dim Result As Long secondnumber = LCD.Text If operation = "+" Then Result = firstnumber + secondnumber ElseIf operation = "-" Then Result = firstnumber - secondnumber ElseIf operation = "*" Then Result = firstnumber * secondnumber ElseIf operation = "/" Then Result = firstnumber / secondnumber End If firstnumber = Result LCD.Text = Result End Sub Private Sub bad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bad.Click firstnumber = LCD.Text LCD.Text = "0" operation = "+" End Sub Private Sub bsub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bsub.Click firstnumber = LCD.Text LCD.Text = "0" operation = "-" End Sub Private Sub bmult_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bmult.Click firstnumber = LCD.Text LCD.Text = "0" operation = "*" End Sub Private Sub bdiv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bdiv.Click firstnumber = LCD.Text LCD.Text = "0" operation = "/" 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