software info by softsys

Search   Chat 


Program Of Calculator

Take One Text Box
Create control array of command button
(For example take one command button and copy that button and past it on form then dialog box ask you "Do you eant to create control array? Then click on Yes")
Change the caption of button 0 to 9

------------------------------------------------------------------------

GENERAL

Dim a As Double

Dim b As Double

Dim opt As String

Dim ans As Double

----------------------------------------------------------------

Private Sub cmddivision_Click(Index As Integer)

a = Text1.Text

opt = "/"

Text1.Text = " "

End Sub

----------------------------------------------------------------

Private Sub cmdequal_Click(Index As Integer)

b = Text1.Text

If opt = "+" Then ans = a + b

If opt = "-" Then ans = a - b

If opt = "*" Then ans = a * b

If opt = "/" Then ans = a / b

If opt = "%" Then ans = (a / b) * 100

Text1.Text = ans

End Sub

----------------------------------------------------------------

Private Sub cmdminus_Click(Index As Integer)

a = Text1.Text

opt = "-"

Text1.Text = " "

End Sub

----------------------------------------------------------------

Private Sub cmdmultiplication_Click(Index As Integer)

a = Text1.Text

opt = "*"

Text1.Text = " "

End Sub

----------------------------------------------------------------

Private Sub cmdonoff_Click(Index As Integer)

Unload Me

End Sub

----------------------------------------------------------------

Private Sub cmdpercent_Click(Index As Integer)

a = Text1.Text

opt = "%"

Text1.Text = " "

End Sub

----------------------------------------------------------------

Private Sub cmdplus_Click(Index As Integer)

a = Text1.Text

opt = "+"

Text1.Text = " "

End Sub

----------------------------------------------------------------

Private Sub Command1_Click(Index As Integer)

Text1.Text = Text1.Text & Command1(Index).Caption

End Sub

----------------------------------------------------------------

Private Sub Command2_Click(Index As Integer)

Text1.Text = " "

End Sub



ADO Connection code