最近写vb程序
使用if条件语句
结果发现如果使用
if a<2 then
....
end if
当a>=2的时候就不再执行中间的语句
但是一旦改为
temp=2
if a<temp then
...
end if
后,判断条件就失效了,即使a>=2了也还是继续执行中间的语句
(所有变量都声明了的)请高手帮我看看这到底是为什么?
使用if条件语句
结果发现如果使用
if a<2 then
....
end if
当a>=2的时候就不再执行中间的语句
但是一旦改为
temp=2
if a<temp then
...
end if
后,判断条件就失效了,即使a>=2了也还是继续执行中间的语句
(所有变量都声明了的)请高手帮我看看这到底是为什么?
解决方案 »
- VB实现CreateProcess重定向输出到一个指定文件
- 500多页分页显示网页里的数据,能否写个程序把他取下来,存于excel?
- webbrowser中有js弹出的对话(alert)请问如何获取弹出窗口的内容!
- VB函数中,如何返回一个数组????? ????
- 散100分调查:有知道人民邮电出版社的《VB 6 大学教程》的吗??
- 抽奖的原理
- 如何根据邮件地址得到该邮件地址所使用的邮件服务器的域名或IP地址(MX记录)
- 如何获取插入光标所在的屏幕坐标?
- To:foolishtiger(吴文智) :ListView1.ColumnHeaders(2).Width =0 我不要这种方法嘛,有没有它法??
- VB 已知按钮句柄,如何监控按钮有没有被点击?
- 小问题,我不懂,帮个忙,等着用~~谢谢先~~
- HELP!!! T_T
1、使用了On error Resume next
2、temp的数据类型有问题
1、TEMP变化了;
2、用了on error resume next并且判断语句有错误;
3、可能a或者TEMP的类型有问题(如String型);
4、你在耍大家玩。
2。查查數據類型
我贴出源代码
(与之无关部分和控件部分省略)
本人刚接触vb
这是一个课程设计中发现的问题
如果问题真的很低级
请大家口下留情Dim group(2, 5, 10) As Integer
Dim all As Integer
Public choice, error, delay, flag1, flag2 As Integer
Public dtime, send As Integer
Private Sub Command1_Click()
choice = 1
End SubPrivate Sub Command3_Click()
Picture1.Cls
all = 1
send = InputBox("发送时间")
dtime = InputBox("超时时间")
error = InputBox("错误帧")
choice = 2
End Sub
Private Sub Form_Load()
all = 1
choice = 0
error = 3
delay = 0
For i = 1 To 20
Label1(i).Caption = ""
Next
Picture1.Scale (0, 0)-(100, 50)
For i = 1 To 10
group(1, 1, i) = 3 + 10 * (i - 1)
group(2, 1, i) = 8 + (i - 1) * 10
NextEnd Sub
Private Sub Timer1_Timer()
Select Case choice
Case 2
If all <= error Then
Picture1.Line (group(1, 1, all), 15)-(group(2, 1, all), 30)
Label1(all).Caption = all
End If
If all < (error + send) And all >= send + 1 Then
Picture1.Line (group(2, 1, all - send), 30)-(group(1, 1, all), 15)
Label1(10 + all - send).Caption = all - send
End IfIf delay = dtime Then
Picture1.Line (group(1, 1, (all - dtime - 1)), 15)-(group(2, 1, (all - dtime - 1)), 30), RGB(255, 0, 0)
Label1(all - dtime - 1).Caption = all - dtime - 1If (all - dtime - send - 1) >= error Then
Picture1.Line (group(2, 1, (all - dtime - send - 1)), 30)-(group(1, 1, (all - dtime - 1)), 15), RGB(255, 0, 255)
Label1(10 + all - dtime - send - 1).Caption = (all - dtime - send - 1)
End If
End IfIf all > error And delay < dtime Then
Picture1.Line (group(1, 1, all), 15)-(group(2, 1, all), 30)
Label1(all).Caption = all
delay = delay + 1
End If
all = all + 1End Select End Sub
If delay = dtime Then
和
If all > error And delay < dtime Then中的delay 与dtime的比较失效了
Public dtime, send As Integer
这种定义变量的方式就有问题
VB6没这么好,你要具体定义Public choice As Integer, error As Integer, delay As Integer, flag1 As Integer, flag2 As Integer
Public dtime As Integer, send As Integer
按照你们说的
问题解决了