运行非常棒,但,当选择“教材版本”,如果没有这个教材版本的,就退出,进入自选抽课,但代码运行时,即使没有,也在上表填写内容,怎么回事?请看代码和截图代码:Dim Filter As String
With e.Form.Controls("学段")
If .Value IsNot Nothing Then
Filter = "学段 = '" & .Value & "'"
End If
End With
With e.Form.Controls("学科")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "学科 = '" & .Value & "'"
End If
End With
With e.Form.Controls("教材版本")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "教材版本 = '" & .Value & "'"
End If
End With
Tables("题目抽取_题库").Filter = Filter
Dim cr As Row = Tables("题目抽取_人员").current
If cr.IsNull("讲课题目") = False Then
msgbox("题目已存在,不能抽取")
Return
End If
Dim lst As new List(of String)
Dim cnt As Integer = Tables("题目抽取_题库").rows.count
Dim i As Integer = Rand.Next(cnt)
MessageBox.Show("是否抽取题目?第一次确认", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
MessageBox.Show("是否抽取题目?第二次确认", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
MessageBox.Show("是否抽取题目?第三次确认", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Dim r As Row = Tables("题目抽取_题库").rows(i)
If r.IsNull("教材版本") = True Then
msgbox("教材版本不存在,请进入自选抽课!")
Return
ElseIf r.IsNull("教材版本") = False Then
cr("学科") = r("学科")
cr("学段") = r("学段")
cr("学期") = r("学期")
cr("年级") = r("年级")
cr("教材版本") = r("教材版本")
cr("讲课题目") = r("题目")
End If
截图:
此主题相关图片如下:截图01.jpg
