If TextBox1.Text = 100 Then
        If CheckBox1.Value = True Then
            MsgBox ("1")
            Else
                If CheckBox12.Value = False Then
                MsgBox ("2")
        End If
        
    Else
    If TextBox12.Text <> 100 Then
      
      If CheckBox12.Value = True Then
            MsgBox ("3")
    
      Else
        If CheckBox12.Value = False Then
            MsgBox ("4")
    
   
       End If
       
    End If编译时报错“else without if”,是if有嵌套么?

解决方案 »

  1.   

    差end if       
      

  2.   

    你自己把自己给else晕了吧
    呵呵
    写代码要注意缩进的啊, 你代码中的if和else以及end if 都对不起来的
    好好看看
      

  3.   

    或许,这种情况下,可以试着用下select case
      

  4.   

    If TextBox1.Text = 100 Then
            If CheckBox1.Value = True Then
                MsgBox ("1")
                Else
                    If CheckBox12.Value = False Then
                    MsgBox ("2")
                    End If
            End If
            
        Else
        If TextBox12.Text <> 100 Then
          
          If CheckBox12.Value = True Then
                MsgBox ("3")
        
          Else
            If CheckBox12.Value = False Then
                MsgBox ("4")
        
       
           End If
           End If
        End If
    End If