No.1使VB窗口的背景图片充满窗体
1、
将窗体的AutoRedraw属性设置为True
2、窗体Picture属性中设置的图片
3、代码
No.2添加信息时,下拉列表中不允许输入
No.3查询信息时,如果查询不到合适的信息,则提示
No.4check复选框只能选择一项,且打上勾才可在文本框中输入,当选择打钩另一个复选框时,原来的文本框内容清空
初始界面,文本框为灰色
Private Sub Form_Load() If Check1(0).Value = 1 Then txtSID.Enabled = True txtSID.BackColor = vbWhite Else txtSID.Enabled = False txtSID.BackColor = &H8000000F End If If Check1(1).Value = 1 Then txtName.Enabled = True txtName.BackColor = vbWhite Else txtName.Enabled = False txtName.BackColor = &H8000000F End If If Check1(2).Value = 1 Then txtCourse.Enabled = True txtCourse.BackColor = vbWhite Else txtCourse.Enabled = False txtCourse.BackColor = &H8000000F End If Me.Height = 8000 Me.Width = 9000 With myFlexgrid .CellAlignment = 4 .TextMatrix(1, 0) = "考试编号" .TextMatrix(1, 1) = "学号" .TextMatrix(1, 2) = "姓名" .TextMatrix(1, 3) = "班号" .TextMatrix(1, 4) = "课程名称" .TextMatrix(1, 5) = "分数" End With End Sub
点击一个复选框,对应文本框中输入内容,其他文本框和复选框为灰色——不可选
Private Sub Check1_Click(Index As Integer) Select Case Index Case 0 txtName.Text = "" txtCourse.Text = "" If Check1(0).Value = 1 Then Check1(1).Enabled = False Check1(2).Enabled = False Else Check1(1).Enabled = True Check1(2).Enabled = True Check1(0).Enabled = True End If If Check1(0).Value = 1 Then txtSID.Enabled = True txtSID.BackColor = vbWhite Else txtSID.Enabled = False txtSID.BackColor = &H8000000F End If Case 1 txtSID.Text = "" txtCourse.Text = "" If Check1(1).Value = 1 Then Check1(0).Enabled = False Check1(2).Enabled = False Else Check1(0).Enabled = True Check1(2).Enabled = True Check1(1).Enabled = True End If If Check1(1).Value = 1 Then txtName.Enabled = True txtName.BackColor = vbWhite Else txtName.Enabled = False txtName.BackColor = &H8000000F End If Case 2 txtSID.Text = "" txtName.Text = "" If Check1(2).Value = 1 Then Check1(0).Enabled = False Check1(1).Enabled = False Else Check1(0).Enabled = True Check1(1).Enabled = True Check1(2).Enabled = True End If If Check1(2).Value = 1 Then txtCourse.Enabled = True txtCourse.BackColor = vbWhite Else txtCourse.Enabled = False txtCourse.BackColor = &H8000000F End If End Select End Sub
如有错误,不吝赐教!