怎样跳出多重循环!不是exit for 我在vb里面有两重for循环,如果满足条件,想从最里面的循环体跳出,以后所有循环语句不再执行。请问该用什么语句? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一种方法:用GOTO 二种方法:巧用FOR 循环与IF判断来解决。不过还得看是什么业务流程! For i = 1 To oAllProfile.Count Step 1 For j = 1 To oAllProfile.Item(i).Count Step 1 If oEntity Is oAllProfile.Item(i).Item(j).SketchEntity Then bFound = True n = i '可以用exit for 吗? GoTo go End If Next Next go: If bFound = True Then 1、使用GoTo语句2、定义变量,判断。dim bExit as booleanbExit = FalseFor i = 1 To oAllProfile.Count Step 1 For j = 1 To oAllProfile.Item(i).Count Step 1 If oEntity Is oAllProfile.Item(i).Item(j).SketchEntity Then bFound = True n = i '可以用exit for 吗? bExit = True Exit For End If Next if bExit then Exit For Next 真有意思.这个网站复制CSDN贴子内容. 如何及时刷新datagrid 找一个好的数据包格式 用Package & Deployment Wizard创建安装文件的问题 已知三点坐标p1,p2,p3,还有圆心o,如何画一个弧,弧和p1,p2,p3点相交? 求救,笔记本电脑 有关IFF,巨简单,在线等!!!!!!!!!!分给第一跟人 怎样在程序里直接执行bat批处理文件 如果要删除一个表的内容,怎么办? 我用vb5编译出来的exe可以直接在没装过vb5的机器上运行吗? 为什么图案刷在内存设备场景中会没有用 uid=sa;pwd=;" 指的是什么用户名和密码?
二种方法:巧用FOR 循环与IF判断来解决。
不过还得看是什么业务流程!
For j = 1 To oAllProfile.Item(i).Count Step 1
If oEntity Is oAllProfile.Item(i).Item(j).SketchEntity Then
bFound = True
n = i
'可以用exit for 吗?
GoTo go
End If
Next
Next
go: If bFound = True Then
2、定义变量,判断。
dim bExit as boolean
bExit = False
For i = 1 To oAllProfile.Count Step 1
For j = 1 To oAllProfile.Item(i).Count Step 1
If oEntity Is oAllProfile.Item(i).Item(j).SketchEntity Then
bFound = True
n = i
'可以用exit for 吗?
bExit = True
Exit For End If
Next
if bExit then Exit For
Next