用HScroll 做加减法运算 OPTION 选择运算符号Dim ,,s As LongPrivate Sub Command1_Click()If Option1 Thens = m + nLabel5.Caption = "运算结果:" & m & "+" & n & "=" & sElseIf Option2 Thens = m - nLabel5.Caption = "运算结果:" & m & "

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 20:46:46

用HScroll 做加减法运算 OPTION 选择运算符号Dim ,,s As LongPrivate Sub Command1_Click()If Option1 Thens = m + nLabel5.Caption = "运算结果:" & m & "+" & n & "=" & sElseIf Option2 Thens = m - nLabel5.Caption = "运算结果:" & m & "
用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

用HScroll 做加减法运算 OPTION 选择运算符号Dim ,,s As LongPrivate Sub Command1_Click()If Option1 Thens = m + nLabel5.Caption = "运算结果:" & m & "+" & n & "=" & sElseIf Option2 Thens = m - nLabel5.Caption = "运算结果:" & m & "
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
'这样改