现在我觉得它是正确的 [英] now i think its correct

查看:72
本文介绍了现在我觉得它是正确的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Command1_Click()

UserWantsOut = True

DoEvents

如果UserWantsOut则

退出

结束如果



结束子




>
现在是正确的吗?为什么它给错误msg退出不在

Private Sub Command1_Click()
UserWantsOut = True
DoEvents
If UserWantsOut Then
Exit For
End If


End Sub





is it correct now? why its giving error msg exit for not within for

推荐答案

不,我不认为你理解不同的例程在VB中的交互方式。 />

想法是你的 For 循环正在对数据进行校正,不断检查变量 UserWantsOut 的值,看看是否需要停止。按钮的Click事件只是将其设置为True。您在Click事件过程中放置​​的 DoEvents 如果测试和退出不属于那里。它们应该放在For循环中。
No, I don''t think you''re understanding the way different routines interact in VB.

The idea is that your For loop which is doing the correction to the data keeps checking the value of the variable UserWantsOut, to see whether it needs to stop. The Click event for the button simply sets it to True. The DoEvents, If test and Exit For that you have placed in the Click event procedure don''t belong there. They should have been put inside the For loop.



Private Sub Command1_Click()

UserWantsOut = True

DoEvents

如果UserWantsOut那么

退出

结束如果


End Sub





现在是否正确?为什么它给出错误msg退出不在
Private Sub Command1_Click()
UserWantsOut = True
DoEvents
If UserWantsOut Then
Exit For
End If


End Sub





is it correct now? why its giving error msg exit for not within for




没有退出...



there is no exit for...

展开 | 选择 | Wrap | 行号



没有退出...

there is no exit for...

展开 | 选择 | Wrap | 行号


这篇关于现在我觉得它是正确的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆