Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help coding calculator buttons

Status
Not open for further replies.

jaymil253

Programmer
Sep 4, 2000
2
US
im tryin to program a calculator through vb6 and im using arrays and i'm having troubles with the memory buttons on the calculator so my question is.
I have 4 buttons in 1 array they are MC[(index 0) (memory clear)], MR [(index 1)(memory return)], M- {(index 2)(memory minus)}, M+ {(index 3)(memory plus)} these buttons are suppose to function like that of a regular calculator with these buttons, any help is need ASAP!!
 
You can simply dim a long as the memory like
Dim MyMem as Long
And then when the button is clicked:

Select case Index
case 0
MyMem = 0
case 1
txtDisplay.text = MyMem
case 2
MyMem = MyMem + val(txtDisplay.text)
case 3
MyMem = MyMem - val(txtDisplay.text)
End Select


That's all1


 
Also, may I know how you prgram the decimal button on the calculator.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top