Private Sub Command1_Click()
   Dim nyear As Integer
   nyear = Val(Text1.Text)
   If Text1.Text <> "" Then
      If (nyear Mod 4 = 0) And (nyear Mod 100 <> 0) Then
         Text2.Text = "闰年"
           If nyear Mod 400 = 0 Then
             Text2.Text = "闰年"
           Else
             Text2.Text = "平年"
           End If
        End If
      Else
    MsgBox "请输入年份!", vbInformation, "提示"
  End If
End Sub请教大家,什么地方出问题了?
基础太弱,感谢大家的帮助!

解决方案 »

  1.   

         If (nyear Mod 4 = 0) And (nyear Mod 100 <> 0) Then 
            Text2.Text = "闰年" 
         ElseIf nyear Mod 400 = 0 Then 
                Text2.Text = "闰年" 
         Else 
                Text2.Text = "平年" 
         End If 
      

  2.   

    if ((nyear mod 4=0) and (nyear mod 100<>0)) or (nyear mod 400=0) then
        '闰年
    else 
        '平年
    endif
      

  3.   

    Private Sub Command1_Click()
      Dim nyear As Integer
      nyear = Val(Text1.Text)
      If Text1.Text <> "" Then
          If ((nyear Mod 4 = 0) And (nyear Mod 100 <> 0)) Or nyear Mod 400 = 0 Then
            Text2.Text = "闰年"
              Else
                Text2.Text = "平年"
              
            End If
          Else
        MsgBox "请输入年份!", vbInformation, "提示"
      End If
    End Sub