有没有晓得这个代码怎样做计算器。(视频更好)

来源:百度知道 编辑:UC知道 时间:2024/05/22 00:49:44
Dim counta As Double, countb As Double, countc As Double, ops As String, ops_single As String
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
End Sub

Private Sub Command2_Click(Index As Integer)
counta = Val(Text1.Text)
ops = Command2(Index).Caption
Text1.Text = ""
End Sub

Private Sub Command3_Click()
countb = Val(Text1.Text)
Select Case ops
Case "+"
Text1.Text = Str(counta + countb)
Case "-"
Text1.Text = Str(counta - countb)
Case "*"
Text1.Text = Str(counta * countb)
Case "/"
If countb = 0 Then
MsgBox "除数不能为零", vbCritical, "出错"
Text1.Text = ""
Text1.SetFocus
Else
Text1.Text = Str(counta / countb)
End If
End Select
End Sub

Private Sub Command4_Click()
Dim strlen As Integer<

要计算器阿,别写写这么多臭代码,我给你几行代码吧

Shell("calc.exe", AppWinStyle.NormalFocus, True, 2)

这是VB.NET的代码行,VB6页有这个函数SHELL的你自己找找资料吧,这个函数怎么用,我不记得VB6怎么写,都什么年代了,还用VB6 ,我的http://new.qzone.qq.com/1047320308去看看,有问题给我留言