Foxtable(狐表)用户栏目专家坐堂 → 控件集合


  共有2695人关注过本帖树形打印复制链接

主题:控件集合

帅哥哟,离线,有人找我吗?
Liangcai
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:300 积分:2541 威望:0 精华:0 注册:2011/9/24 13:30:00
控件集合  发帖心情 Post By:2016/4/25 10:25:00 [只看该作者]

身份证号码不等于18位,父亲电话|母亲电话不等于11位(父亲电话|母亲电话只要有一个就可以了),求代码怎样改,谢谢!

 

If e.Form.Controls("学生姓名").Value IsNot Nothing Then
    Dim kjmc() As String '控件名称
    Dim kjmcjh As String
    kjmcjh = "身份证号,民族,父亲姓名,母亲姓名,父亲电话|母亲电话,户籍省,户籍县,户籍镇,暂住街道,暂住社区"   '控件名称集合
    kjmc = kjmcjh.split(",")
    For i As Integer = 0 To kjmc.Length - 1
        Dim cct() As String = kjmc(i).Split("|")
        If cct.Length > 1 Then
            Dim flag As String = ""
            For j As Integer = cct.Length - 1 To 0 Step -1
                flag = cct(j)
                If e.Form.Controls(flag).Text <> Nothing Then
                    flag = ""
                    Exit For
                End If
            Next
            If flag > "" Then
                MessageBox.Show("请输入:【" & flag & "】 !","提示", MessageBoxButtons.OK,MessageBoxIcon.Question)
            End If
        Else
            If e.Form.Controls(kjmc(i)).text = "" Then
                MessageBox.Show("请输入:【" & kjmc(i) & "】 !","提示", MessageBoxButtons.OK,MessageBoxIcon.Question)
                e.Form.Controls(kjmc(i)).Select()
                Return
            End If
        End If
    Next
End If


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/25 10:32:00 [只看该作者]

If e.Form.Controls("学生姓名").Value IsNot Nothing Then
    Dim kjmc() As String '控件名称
    Dim kjmcjh As String
    kjmcjh = "身份证号,民族,父亲姓名,母亲姓名,父亲电话|母亲电话,户籍省,户籍县,户籍镇,暂住街道,暂住社区"   '控件名称集合
    kjmc = kjmcjh.split(",")
    For i As Integer = 0 To kjmc.Length - 1
        Dim cct() As String = kjmc(i).Split("|")
        If cct.Length > 1 Then
            Dim flag As String = ""
            For j As Integer = cct.Length - 1 To 0 Step -1
                flag = cct(j)
                If e.Form.Controls(flag).Text <> Nothing Then
                    flag = ""
                    Exit For
                End If
            Next
            If flag > "" Then
                MessageBox.Show("请输入:【" & flag & "】 !","提示", MessageBoxButtons.OK,MessageBoxIcon.Question)
            End If
        Else
            If e.Form.Controls(kjmc(i)).text = "" Then
                MessageBox.Show("请输入:【" & kjmc(i) & "】 !","提示", MessageBoxButtons.OK,MessageBoxIcon.Question)
                e.Form.Controls(kjmc(i)).Select()
                Return
            ElseIf kjmc(I) = "身份证号" Then
                If e.Form.Controls(kjmc(i)).text.Length <> 18 Then
                    MessageBox.Show("身份证号必须是18位 !","提示", MessageBoxButtons.OK,MessageBoxIcon.Question)
                    e.Form.Controls(kjmc(i)).Select()
                    Return
                End If
            End If
        End If
    Next
End If


 回到顶部