变量判断问题
MsgBox Xsurface(q): MsgBox Xsurface(q + 1)MsgBox Xr
If (Xr >= Xsurface(q) And Xr <= Xsurface(q + 1)) Then
msgbox "1"
else
msgbox "0"
end if
前面输出的变量值分别为:-2.235;-1.55;-2.235
运行程序输出的结果是0,即程序认为if的条件为假;
为查找错误,新建了一个vb如下:
Private Sub Form_Load()
Dim a, b, c As Double
a = -2.235: b = -2.235: c = -1.55
If (b >= a And b <= c) Then
Text1.Text = 1
Else
Text1.Text = 0
End If
End Sub
新建的这个text1.text为1,即程序认为if条件为真;有老哥遇到过相同的情况吗?望不吝赐教,谢谢