以下是引用片段: 其关键代码实现如下: Public Sub UpdateList() '设置表格的标头和样式 '动态从数据库中装载数据 '1 Dim arrName() arrName = Array("编号", "题目内容", "答案A", "答案B", "答案C", "答案D", "正确答案") Dim arrColwidth() arrColwidth = Array(0, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6 - 300) ddd.Cols = 7 ddd.Rows = 2 Dim i As Long For i = 0 To ddd.Cols - 1 ddd.ColWidth(i) = arrColwidth(i) ddd.TextMatrix(0, i) = arrName(i) ddd.TextMatrix(1, i) = "" Next ddd.Rows = 28 Call UpdateDDD(ddd, ExecSql("SELECT ID, Title, AnswerA, AnswerB, AnswerC, AnswerD, Answer FROM dbo.MultiProblem where title like '%" & Me.Text1.Text & "%' and answer like '%" & Me.Text2.Text & "%'"), 1) End Sub Private Sub UserControl13_Click() '显示多选题信息 If ddd.Row <= 0 Then Exit Sub If Trim(ddd.TextMatrix(ddd.Row, 0)) = "" Then Exit Sub frmMuiProblemAdd.idkey = Trim(ddd.TextMatrix(ddd.Row, 0)) frmMuiProblemAdd.boolReadOnly = True frmMuiProblemAdd.Show 1 End Sub
|