请教达人,vb的循环有没有像C++中 continue 这样的语句。
意思就是当出错时候,跳出当前循环,继续执行下一条循环。并不是结束该循环。谢。

解决方案 »

  1.   

    请教达人,vb的循环有没有像C++中 continue 这样的语句。------没有就是当出错时候,跳出当前循环,继续执行下一条循环。并不是结束该循环。---在循环前写上: On Error Resume Next例如:  
          On Error Resume Next
       for i = 0 to 100 
              i = i + 1
          next
      

  2.   

    VB中二者兼得的没有你可以用on error resume next来跳过也可以用exit for、exit do等来跳出循环
      

  3.   

    可以
    dim N as integerfor N =1 to 100 step 1
       on Error goto next N
      ------
      -------
    next N或者加标签:
    for N =1 to 100 step 1
       on Error goto next handler
      ------
      ------
       ------
    handler:
    next N
      

  4.   

    上面加标签的 on Error goto next handler应改为 on Error goto handler
      

  5.   

    没有continue
    但是这样的情况可以用if 和for共同来完成,也就是说即使不借助continue也可以做到
      

  6.   

    你这帖子发了几份?
    bool a=false;
    for(int i=0;i<=100;i++)
    {
      ...
      if(a) continue;
      ...
    }
    相当于dim i as long
    dim a as boolean
    for i = 0 to 100
    ...
      if a then goto hell
    ...
    hell:
    next