用vb做计算器中的一个小问题

来源:百度知道 编辑:UC知道 时间:2024/05/20 01:38:16
Public value As Double ' 结果
Public date1 As Double
Public date2 As Double
Public flag As Boolean
Public char As String '符号
Public Function division(date1 As Double, date2 As Double) '算法/
If (date2 = 0) Then
MsgBox "除数不能为“0”!请重新输入除数。", vbOKOnly + vbInformation, "除零错误"
Index = intOperator
Exit Sub
Else
value = date1 / date2

division = value

End Function

小弟刚学VB没几天,实在是想不懂哪里出错了。
我是创建的函数--除法,总是提示我错了。
哪个大哥能帮帮忙啊,愁死我了!!!!

Function division(date1 As Double, date2 As Double) '算法/
If (date2 = 0) Then
MsgBox "除数不能为“0”!请重新输入除数。", vbOKOnly + vbInformation, "除零错误"
Index = intOperator
Exit Function
Else
Value = date1 / date2
End If
division = Value

End Function

Private Sub Command1_Click()
Print division(4, 2)
End Sub

Public Function division(date1 As Double, date2 As Double)
函数定义时返回类型没有定义
在Public Function division(date1 As Double, date2 As Double)后边
追加“ AS Double”