| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

问题点数：0 回复次数：5

Private Sub Label1_Click()

End Sub

SymbelLabel.Caption = "+"
OutputText.Text = ""
End Sub

Private Sub DivideOption_Click()
SymbelLabel.Caption = "/"
OutputText.Text = ""
End Sub

Private Sub MisnusOption_Click()
SymbelLabel.Caption = "-"
OutputText.Text = ""
End Sub

Private Sub MultiOption_Click()
SymbelLabel.Caption = "*"
OutputText.Text = ""
End Sub

Private Sub RunCommand_Click()
Dim Number1, Number2, Result As Single

Number1 = Val(InputText1.Text)
Number2 = Val(InputText2.Text)

Result = Number1 + Number2
End If
If Minusption.Value = True Then
Result = Number1 - Number2
End If
If MultiOption.Value = True Then
Result = Number1 * Number2
End If
If DiviOption.Value = True Then
Result = Number1 / Number2
End If
End Sub

Result = Number1 + Number2
End If
If Minusption.Value = True Then
Result = Number1 - Number2
End If
If MultiOption.Value = True Then
Result = Number1 * Number2
End If
If DiviOption.Value = True Then
Result = Number1 / Number2
End If
End Sub

Result = Number1 + Number2
End If
If Minusption.Value = True Then
Result = Number1 - Number2
End If
If MultiOption.Value = True Then
Result = Number1 * Number2
End If
If DiviOption.Value = True Then
Result = Number1 / Number2
End If
End Sub

If DiviOption.Value = True Then
Result = Number1 / Number2
End If
End Sub

Number2 VAL(Number2)

4个意见
1、定义变量
Dim Number1, Number2, Result As Single是不规范的

2、对于多分支结构，最好使用select...case结构，简单明了，且提高程序效率。
3、对比Private Sub MisnusOption_Click()
If Minusption.Value = True Then

4、对比If DiviOption.Value = True Then
Private Sub DivideOption_Click()

• 6
• 1/1页
• 1