【Cumputer】《第一次机房收费系统》总结八 其他

来源:互联网 发布:ip下载软件 编辑:程序博客网 时间:2024/06/06 23:55

一、不为空

 

公共模块代码:


Public Function Testtxt(txt As String) As Boolean  ' Testtxt(TxtCardNO.Text)         '判断输入内容是否为空    If Trim(txt) = "" Then         Testtxt = False    Else        Testtxt = True    End If    End Function


窗体使用代码:


    '卡号不能为空    If Not Testtxt(TxtCardNo.Text) Then                MsgBox "请输入卡号!", vbOKOnly + vbExclamation, "提示"        TxtCardNo.SetFocus        Exit Sub         End If

二、限制输入


Private Sub TxtInquir1_KeyPress(KeyAscii As Integer)    '限制输入特殊字符    Dim cTemp As String    cTemp = "#@!$%^&*()`-=\][;'/.,:?<>+_|·;‘】【、|}{。,、?》《"     '限制输入字符    If InStr(1, cTemp, Chr(KeyAscii)) <> 0 Then        KeyAscii = 0    End IfEnd SubPrivate Sub TxtUserID_KeyPress(KeyAscii As Integer)    '只可输入数字    Select Case KeyAscii            Case 8        Case Asc("0") To Asc("9")        Case Else            MsgBox "请输入数字!", 48, "提示"                        KeyAscii = 0            End SelectEnd Sub

三、MDI子窗体如何显示在主窗体图片上方

 

公共模块代码

'设置子窗体Public Declare Function SetParent Lib "user32" _(ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

VB-外接程序-API浏览器-文件-加载文本文件-WIN32API-SetParent






主窗体代码:





阅读全文
0 0
原创粉丝点击