学生信息管理系统之优化二

  1. 查询窗体复选框优化
    复选框取消勾选之后文本框中的内容和查询的内容也被清空
    'Check√取消后面的内容随之取消
    Private Sub Check1_Click()
    If Not Check1.Value Then
    txtSID.Text = “”
    With myFlexgrid
    .Rows = 2
    .CellAlignment = 4
    .TextMatrix(1, 0) = “”
    .TextMatrix(1, 1) = “”
    .TextMatrix(1, 2) = “”
    .TextMatrix(1, 3) = “”
    .TextMatrix(1, 4) = “”
    .TextMatrix(1, 5) = “”
    .TextMatrix(1, 6) = “”
    .TextMatrix(1, 7) = “”
    End With
    End If
    End Sub
  2. 文本框加限制
    一、限制只能输入数字
    Private Sub txtsid_KeyPress(keyascii As Integer)
    If keyascii >= 33 Then
    If keyascii <= vbKey9 And keyascii >= vbKey0 Then
    Else
    keyascii = 0
    MsgBox “请输入数字!”
    End If
    End If
    End Sub
    二、限制不能输入数字
    Private Sub Txtname_KeyPress(keyascii As Integer) '姓名不能输入数字
    If (keyascii >= 48 And keyascii <= 57) Then
    MsgBox “不允许输入数字”, vbOKOnly + vbExclamation, “警告”
    keyascii = 0 '键盘不能用
    End If
    End Sub
    三、限制姓名字数
    '设置姓名字节的限制,由2个到4个字组成,即4-8个字节组成
    Private Sub txtdirector_LostFocus()
    If Not LenB(txtDirector) = 0 And LenB(txtDirector) < 4 Or LenB(txtDirector) > 8 Then
    txtDirector.SetFocus
    txtDirector.SelLength = Len(txtDirector.Text)
    txtDirector.SelStart = 0
    MsgBox “姓名输入错误”
    End If
    End Sub
    四、下拉框禁止输入
    Private Sub comboclassno_keypress(keyascii As Integer)
    keyascii = 0
    End Sub
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孙正嗯大正

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值