所谓的连加 和 连乘其实就是和电脑计算器一样,当1+2后再按"+"号的时候text显示的是3,这就是我所谓的 连加 和连乘 .
由于我是vb 的新手,这个网站也是别人给推荐的,所以我刚刚注册,没有分数给大家,希望大家谅解.
以下是我的代码,我有家一个静态变量的想法,不知道对不对,希望大家多多指点,谢谢了.希望大家能帮我解决这个问题.
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
End Sub
Private Sub Command2_Click(Index As Integer)
Text3.Text = Text3.Text + Command2(Index).Caption
Text2.Text = Text1.Text
Text1.Text = ""
End Sub
Private Sub Command3_Click()
Select Case Text3.Text
Case "+"
Text1.Text = Val(Text2.Text) + Val(Text1.Text)
Case "-"
Text1.Text = Val(Text2.Text) - Val(Text1.Text)
Case "*"
Text1.Text = Val(Text2.Text) * Val(Text1.Text)
Case "/"
Text1.Text = Val(Text2.Text) / Val(Text1.Text)
Case "x^2"
Text1.Text = Val(Text2.Text) * Val(Text2.Text)
Case "1/x"
Text1.Text = "0" & 1 / Val(Text2.Text)
Case "sqr"
Text1.Text = Sqr(Text2.Text)
Case "%"
Text1.Text = Text2.Text / 100
End Select
Text3.Text = ""
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command5_Click()
Dim numChar As Integer
numChar = Len(Text1.Text)
If numChar > 0 Then
Text1.Text = Left$(Text1.Text, numChar - 1)
End If
End Sub
Private Sub Form_Load()
Form1.Width = Screen.Width / 4
Form1.Height = Screen.Height / 5 * 3
Form1.Left = (Screen.Width - Form1.Width) / 2
Form1.Top = (Screen.Height - Form1.Height) / 2
End Sub
Private Sub Text2_Change()
Text2.Text = Text1.Text
End Sub
我的QQ505811721 如果要我的VB程序来指点请加我谢谢了,因为我不知道怎么上传附件,我是纯新手!!!
由于我是vb 的新手,这个网站也是别人给推荐的,所以我刚刚注册,没有分数给大家,希望大家谅解.
以下是我的代码,我有家一个静态变量的想法,不知道对不对,希望大家多多指点,谢谢了.希望大家能帮我解决这个问题.
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
End Sub
Private Sub Command2_Click(Index As Integer)
Text3.Text = Text3.Text + Command2(Index).Caption
Text2.Text = Text1.Text
Text1.Text = ""
End Sub
Private Sub Command3_Click()
Select Case Text3.Text
Case "+"
Text1.Text = Val(Text2.Text) + Val(Text1.Text)
Case "-"
Text1.Text = Val(Text2.Text) - Val(Text1.Text)
Case "*"
Text1.Text = Val(Text2.Text) * Val(Text1.Text)
Case "/"
Text1.Text = Val(Text2.Text) / Val(Text1.Text)
Case "x^2"
Text1.Text = Val(Text2.Text) * Val(Text2.Text)
Case "1/x"
Text1.Text = "0" & 1 / Val(Text2.Text)
Case "sqr"
Text1.Text = Sqr(Text2.Text)
Case "%"
Text1.Text = Text2.Text / 100
End Select
Text3.Text = ""
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command5_Click()
Dim numChar As Integer
numChar = Len(Text1.Text)
If numChar > 0 Then
Text1.Text = Left$(Text1.Text, numChar - 1)
End If
End Sub
Private Sub Form_Load()
Form1.Width = Screen.Width / 4
Form1.Height = Screen.Height / 5 * 3
Form1.Left = (Screen.Width - Form1.Width) / 2
Form1.Top = (Screen.Height - Form1.Height) / 2
End Sub
Private Sub Text2_Change()
Text2.Text = Text1.Text
End Sub
我的QQ505811721 如果要我的VB程序来指点请加我谢谢了,因为我不知道怎么上传附件,我是纯新手!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货