⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memberre.frm

📁 原创VB+SQL影音租赁系统 醮简单 具体看里边的文本文档
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   480
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "电子邮件"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   240
         Left            =   360
         TabIndex        =   19
         Top             =   2700
         Width           =   960
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "电话"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   240
         Left            =   600
         TabIndex        =   18
         Top             =   3300
         Width           =   480
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "联系地址"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   240
         Left            =   360
         TabIndex        =   17
         Top             =   4500
         Width           =   960
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "邮编"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   240
         Left            =   600
         TabIndex        =   16
         Top             =   5100
         Width           =   480
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "身份证号码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   240
         Left            =   240
         TabIndex        =   15
         Top             =   3900
         Width           =   1200
      End
   End
   Begin VB.Frame Frame2 
      Height          =   1095
      Left            =   480
      TabIndex        =   24
      Top             =   6480
      Width           =   5895
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "会员信息注册"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF00FF&
      Height          =   300
      Left            =   2400
      TabIndex        =   13
      Top             =   240
      Width           =   1800
   End
End
Attribute VB_Name = "MemberRE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim com As Command
Dim rst As Recordset

Private Sub CancelBT_Click()
Unload Me
End Sub

Private Sub ClearBT_Click()
For Each Control In MemberRE
    If TypeOf Control Is TextBox Then
      If Control <> TID Then
        Control.Text = ""
      End If
    End If
Next
End Sub

Private Sub Form_Load()
Set com = New Command
Set rst = New Recordset
addid
'MemberRE.Tname.SetFocus
End Sub

Private Sub OkBt_Click()
For Each Control In MemberRE
    If TypeOf Control Is TextBox Then
     If Control <> TID Then
        If Trim(Control.Text) = "" Then
            MsgBox "请输入完整信息"
            Exit Sub
        End If
      End If
    End If
Next

If Len(Tname.Text) > 15 Then
    MsgBox "姓名过长!请检查!"
    Tname.SetFocus
    Exit Sub
End If
If Asc(Trim(TAge.Text)) > 57 Or Asc(Trim(TAge.Text)) < 48 Then
   MsgBox "您的年龄有问题!请输入数字!"
   TAge.SetFocus
    ElseIf Len(Trim(TAge.Text)) > 3 Then
           MsgBox "您的年龄有那么大嘛!请检查!"
           TAge.SetFocus
   ElseIf Trim(TAge.Text) = 0 Then
           MsgBox "0岁的您也能看电影嘛!"
           TAge.SetFocus
    Exit Sub
End If
If ComboSex.Text = "" Then
   MsgBox "请选择您的性别!"
   ComboSex.SetFocus
End If
If Len(Trim(TEmail.Text)) > 30 Then
    MsgBox "电子邮件过长!请检查!"
    TEmail.SetFocus
    Exit Sub
End If

If MemberRE.checkemail(TEmail.Text) = 0 Then
    MsgBox "电子邮件输入有误!请检查!"
    TEmail.SetFocus
    Exit Sub
End If

If Asc(Trim(TPhone.Text)) > 57 Or Asc(Trim(TPhone.Text)) < 48 Then
    MsgBox "电话号码有误!请输入数字!"
    TPhone.SetFocus
    ElseIf Len(Trim(TPhone.Text)) > 13 Or Len(Trim(TPhone.Text)) < 8 Then
            MsgBox "电话号码有误!请检查!"
            TPhone.SetFocus
    Exit Sub
End If
If Asc(Trim(TCardnum.Text)) > 57 Or Asc(Trim(TCardnum.Text)) < 48 Then
    MsgBox "身份证号码有误!请输入数字!"
    TCardnum.SetFocus
    ElseIf Len(Trim(TCardnum.Text)) > 18 Or Len(Trim(TCardnum.Text)) < 15 Then
            MsgBox "身份证号码有误!请检查!"
            TCardnum.SetFocus
    Exit Sub
End If
If Asc(Trim(TPostcode.Text)) > 57 Or Asc(Trim(TPostcode.Text)) < 48 Then
          MsgBox "邮政编码有误!请输入数字!"
          TPostcode.SetFocus
    ElseIf Len(Trim(TPostcode.Text)) > 6 Then
           MsgBox "邮编过长!请检查!"
           TPostcode.SetFocus
    Exit Sub
End If
Dim id, name, money, age, sex, email, address, postcode, phone, cardnum As String

id = TID.Text
name = Tname.Text
age = TAge.Text
sex = ComboSex.Text
email = TEmail.Text
address = TAddress.Text
postcode = TPostcode.Text
phone = TPhone.Text
cardnum = TCardnum.Text
money = TMoney.Text
'On Error GoTo err
'com.ActiveConnection = con
rst.Open "insert Member values('" & id & "','" & name & "'," & money & ",'" & age & "','" & sex & "','" & email & "','" & _
address & "','" & postcode & "','" & phone & "','" & cardnum & "')", con, adOpenDynamic, adLockOptimistic
MsgBox "您的信息注册成功!:)欢迎光临!"
Unload Me
Exit Sub
err:
MsgBox "请确认数据库是否连接!"
End Sub

Public Function checkemail(email As String)
Dim a, b, n As Integer
n = Len(email)
a = 0
b = 0
For ctr = 1 To n
    If Mid(email, ctr, 1) < "#" And Mid(email, ctr, 1) > "~" And Mid(email, ctr, 1) = "?" Then
        checkemail = 0
        Exit Function
    End If
    If Mid(email, ctr, 1) = "@" Then
        a = a + 1
    End If
    If Mid(email, ctr, 1) = "." Then
        b = 1
    End If
Next ctr
   
    If a = 1 And b = 1 Then
        checkemail = 1
        Exit Function
    End If
    checkemail = 0

End Function

Public Sub addid()
Dim id As String
'Dim rst As Recordset
'Set rst = New Recordset
'On Error GoTo err
com.ActiveConnection = con
rst.Open "select cMemberId from Member", con, adOpenDynamic, adLockOptimistic
If rst.EOF = True Then
    id = "00001"
Else
    id = getid(Trim(rst!cMemberID))
    rst.MoveNext
    Do While rst.EOF = False
        If id = Trim(rst!cMemberID) Then
            id = getid(Trim(rst!cMemberID))
            rst.MoveNext
        Else
            Exit Do
        End If
    Loop
End If
TID.Text = id
'rst.MoveFirst
rst.Close
Exit Sub
err:
MsgBox "数据库还未连接!"
Unload Me
End Sub
Private Function getid(temp As String)
temp = temp + 1
If temp < 10 Then
    getid = "0000" & temp
    Exit Function
End If
If temp < 100 Then
    getid = "000" & temp
    Exit Function
End If
If temp < 1000 Then
    getid = "00" & temp
    Exit Function
End If
If temp < 10000 Then
    getid = "0" & temp
    Exit Function
Else
    getid = temp
End If
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -