for i=1 to 4
    x=2
    u=p       '当p=3时正常执行,否则不往下执行,直接执行i的下一个值
    y=3
next
请问这条语句怎么写呀?

解决方案 »

  1.   

    for i=1 to 4
        x=2
        u=p   
    if p<>3 then
    exit sub
    endif    
        y=3
    next
      

  2.   

    If p <> 3 Then Continue For
      

  3.   

    for i=1 to 4
        x=2
        u=p       '当p=3时正常执行,否则不往下执行,直接执行i的下一个值
        if p=3 then
           ...
           y=3
        end if
    next或者
    for i=1 to 4
        x=2
        u=p       '当p=3时正常执行,否则不往下执行,直接执行i的下一个值
        if p<>3 then goto cnt
         y=3
    cnt:
    next
      

  4.   

    注:Continue For仅在Visual Basic 2005或更高版本中才有
      

  5.   

    VB6里没有什么类似于 Continue For 的关键字吗?只能用if?
      

  6.   

    for i=1 to 4
        x=2
        u=p
        if p<>3 then goto cnt
        y=3
    next
    for i=1 to 4
        x=2
        u=p
        if p<>3 then goto cnt
        y=3
    next
    exit sub
    cnt:
    next
    end sub这样写不会错吧?
      

  7.   

    试试这个吧for i=1 to 4
        x=2
        u=p   
        if p=3 then
           y=3
        endif    
    next
      

  8.   

    vb里面没有什么continue的东西。标签和goto语句的话也是不推荐使用的,最好用if