作业帮 > 数学 > 作业

用HScroll 做加减法运算 OPTION 选择运算符号

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/11/09 10:02:44
用HScroll 做加减法运算 OPTION 选择运算符号
Dim ,,s As Long
Private Sub Command1_Click()
If Option1 Then
s = m + n
Label5.Caption = "运算结果:" & m & "+" & n & "=" & s
Else
If Option2 Then
s = m - n
Label5.Caption = "运算结果:" & m & "-" & n & "=" & s
Else
If Option3 Then
s = m * n
Label5.Caption = "运算结果:" & m & "*" & n & "=" & s
Else
s = Format(m / n,"0.00")
Label5.Caption = "运算结果:" & m & "/" & n & "=" & s
End If
End If
End If
End Sub
Private Sub Form_Load()
End Sub
Private Sub HScroll1_Change()
m = HScroll1.Value
Label3.Caption = m
End Sub
Private Sub HScroll2_Change()
n = HScroll2.Value
Label4.Caption = n
End Sub
算不出结果来 都等于0
Option Explicit
Dim m!,n!,s As Long
Private Sub Command1_Click()
If Option1 Then
s = m + n
Label5.Caption = "运算结果:" & m & "+" & n & "=" & s
Else
If Option2 Then
s = m - n
Label5.Caption = "运算结果:" & m & "-" & n & "=" & s
Else
If Option3 Then
s = m * n
Label5.Caption = "运算结果:" & m & "*" & n & "=" & s
Else
Label5.Caption = "运算结果:" & m & "/" & n & "=" & Format(m / n,"0.00")
End If
End If
End If
End Sub
Private Sub Form_Load()
Option1.Value = True
End Sub
Private Sub HScroll1_Change()
m = HScroll1.Value
Label3.Caption = m
End Sub
Private Sub HScroll2_Change()
n = HScroll2.Value
Label4.Caption = n
End Sub
'这样改