Create simple calculator using VB 6.0
Open new project.
Add 16 Command Button & text box.
Change the command button caption 0 , 1 , 2 , 3 , 4 ,5 , 6 , 7 , 8 , 9 , . , + , - , * , / and =
Create 0-9 command button control array.
Like cmbNo(0) , cmdNo(1) , cmdNo(2), …., cmdNo(9) Like this..
Change text box name txtno
Change other command button sutable name.
======================
Coding
Dim no1 As Double
Dim no2 As Double
Dim symbol As String
______________________
Private Sub cmdAdd_Click()
no1 = Val(txtNo.Text)
symbol = "+"
txtNo.Text = ""
End Sub
_______________________
Private Sub cmddevide_Click()
no1 = Val(txtNo.Text)
symbol = "/"
txtNo.Text = ""
End Sub
________________________
Private Sub cmddot_Click()
txtNo.Text = txtNo.Text & "."
End Sub
________________________
Private Sub cmdEqul_Click()
no2 = Val(txtNo.Text)
If symbol = "+" Then
txtNo.Text = Format(Val(no1 + no2), "0.00")
ElseIf symbol = "-" Then
txtNo.Text = Format(Val(no1 - no2), "0.00")
ElseIf symbol = "*" Then
txtNo.Text = Format(Val(no1 * no2), "0.00")
ElseIf symbol = "/" Then
txtNo.Text = Format(Val(no1 / no2), "0.00")
End If
End Sub
________________________
Private Sub cmdminus_Click()
no1 = Val(txtNo.Text)
symbol = "-"
txtNo.Text = ""
End Sub
________________________
Private Sub cmdmul_Click()
no1 = Val(txtNo.Text)
symbol = "*"
txtNo.Text = ""
End Sub
__________________________
Private Sub cmdNO_Click(Index As Integer)
txtNo.Text = txtNo.Text & Index
End Sub
======================
If you have any doubt please comment it. I will help you.
Download sample project (3 MB)
http://www.fileserve.com/file/eBBTaZn/Calculater.rar
Download sample project (3 MB)
http://www.fileserve.com/file/eBBTaZn/Calculater.rar



code eke podi error ekak tiyenawa! hadala denna puluwanda?
Mokakkda error eaka.. kiyanna..
i can creat a cal using python. Awesome e- tutez. Nice share, and very informative.
Thanks buddy... :) :)
error
Check again. it s working fine.
it working thanks
Welcome..!!
please send me the code that can add more than two numbers in your calculator
give your e-mail address
please send me source soklin102@gmail.com
Please i need a code for the 'MC, MR,M-,M+'. Pls kindly help me out