Option ExplicitPrivate Sub ChkDate_Click(Index As Integer)             '选项按钮
   If ChkDate(Index).Value = True Then
      msgbox ("选择了" & chkdate(index).Caption ,vbInformation + vbOKOnly ,"学期安排")
   End If
End SubPrivate Sub CmdExit_Click()
   Unload Me
   End
End SubPrivate Sub OptSubject_Click(Index As Integer)                '复选框
   If OptSubject(Index).Value = 1 Then
      msgbox ("选择了" & optsubject(index).Caption ,vbInformation + vbOKOnly ,"课程安排")
   End If
End Sub
程序要求返回选定的复选框和选项按钮的值,为什么运行后提示语法错误呢?

解决方案 »

  1.   

    If ChkDate(Index).Value = 1 Then
      

  2.   

    If ChkDate(Index).Checked = vbChecked Then
      

  3.   

    Private Sub ChkDate_Click(Index As Integer)             
       If ChkDate(Index).Value = 1 Then
          msgbox "选择了" & chkdate(index).Caption ,vbInformation + vbOKOnly ,"学期安排"
       End If
    End SubPrivate Sub CmdExit_Click()
       Unload Me
       End
    End SubPrivate Sub OptSubject_Click(Index As Integer)                
       If OptSubject(Index).Value = True Then
          msgbox "选择了" & optsubject(index).Caption ,vbInformation + vbOKOnly ,"课程安排"
       End If
    End Sub
    改成以上的。把msgbox的括号去掉。
    复选框要用value=1,单选框要用value=true