标题: 用VB写的欧姆定律自动计算器A1.0 [打印本页] 作者: hts2008222 时间: 2016-4-11 23:12 标题: 用VB写的欧姆定律自动计算器A1.0 用于快速计算欧姆定律的电流电压电阻参数,很方便! 作者: hts2008222 时间: 2016-4-11 23:14
有附件的,没有上传成功,什么情况啊?作者: hts2008222 时间: 2016-4-11 23:18
上传源码,大家自行研究好了
如下:
Private Sub Command1_Click()
Dim a, b, result As Double
a = Text2.Text
b = Text3.Text
result = 0
If b <> 0 Then
result = a * b
Text1.Text = result
Else
MsgBox "除数不能为零"
End If
End Sub
Private Sub Command2_Click()
Dim a, b, result As Double
a = Text1.Text
b = Text3.Text
result = 0
If b <> 0 Then
result = a / b
Text2.Text = result
Else
MsgBox "除数不能为零"
End If
End Sub
Private Sub Command3_Click()
Dim a, b, result As Double
a = Text1.Text
b = Text2.Text
result = 0
If b <> 0 Then
result = a / b
Text3.Text = result
Else
MsgBox "除数不能为零"
End If
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Command5_Click()
Text1.Text = "1"
Text2.Text = "1"
Text3.Text = "1"
End Sub