Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21350

VB6 Calculator. pls help. new in vb6

$
0
0
here is a code for a basic calculator

LAB-3/PROGRAM-1 DATE:19.02.2014
#Write a program to design a simple calculator in VB
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
End Sub
Private Sub Command2_Click()
a = Val(Text1.Text)
Text1.Text = " "
c1 = 1
End Sub
Private Sub Command3_Click()
a = Text1.Text
Text1.Text = " "
c1 = 2
End Sub
Private Sub Command4_Click()
a = Text1.Text
Text1.Text = " "
c1 = 3
End Sub
Private Sub Command5_Click()
a = Text1.Text
Text1.Text = " "
c1 = 4
End Sub
Private Sub Command6_Click()
b = Text1.Text
Text1.Text = " "
If c1 = 1 Then
c = a + b
ElseIf c1 = 2 Then
c = a - b
ElseIf c1 = 3 Then
c = a * b
ElseIf c1 = 4 Then
c = a / b
ElseIf c1 = 5 Then
c = a Mod b
End If
Text1.Text = c
End Sub
Private Sub Command7_Click()
a = Text1.Text
Text1.Text = " "
c1 = 5
End Sub
Private Sub Command8_Click()
Text1.Text = ""
End Sub



pls explain what does this line do:

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

thnx

Viewing all articles
Browse latest Browse all 21350


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>