以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  控件输入  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=57564)

--  作者:Lc
--  发布时间:2014/9/26 16:51:00
--  控件输入


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20140926164520.png
图片点击可在新窗口打开查看

学生姓名必输, 父亲姓名和母亲姓名两者必输一个,请求保存代码?谢谢!

 


Dim kjmc() As String \'控件名称
Dim kjmcjh As String
    kjmcjh = "学生姓名,????" \'控件名称集合
    kjmc = kjmcjh.split(",")
    For i As Integer = 0 To kjmc.Length - 1
        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
    Next


--  作者:Bin
--  发布时间:2014/9/26 16:54:00
--  
if e.form.controls("学生姓名").TExt <> "" andalso (e.form.controls("父").text<> "" orelse e.form.controls("母").text <> "")  then  
--  作者:Bin
--  发布时间:2014/9/26 16:54:00
--  
if e.form.controls("学生姓名").TExt <> "" andalso (e.form.controls("父").text<> "" orelse e.form.controls("母").text <> "")  then  
messagebox.show("不能为空")
end if

--  作者:有点甜
--  发布时间:2014/9/26 17:05:00
--  

代码

 

Dim kjmc() As String \'控件名称
Dim kjmcjh As String
kjmcjh = "textbox1,textbox2|textbox3" \'控件名称集合
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


--  作者:Lc
--  发布时间:2014/9/28 8:13:00
--  

谢谢!