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

📄 foradd.frm

📁 输入个人联系方式
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            TabIndex        =   22
            Text            =   "TextClass"
            Top             =   240
            Width           =   1995
         End
         Begin VB.TextBox TextZY 
            Height          =   285
            Left            =   3735
            TabIndex        =   21
            Text            =   "TextZY"
            Top             =   240
            Width           =   1815
         End
         Begin VB.TextBox TextNum 
            Height          =   270
            Left            =   480
            TabIndex        =   20
            Text            =   "TextNum"
            Top             =   570
            Width           =   810
         End
         Begin VB.TextBox TextTelQS 
            Height          =   285
            Left            =   3765
            TabIndex        =   19
            Text            =   "TextTelQS"
            Top             =   570
            Width           =   1785
         End
         Begin VB.TextBox TextZW 
            Height          =   270
            Left            =   1725
            TabIndex        =   18
            Text            =   "TextZW"
            Top             =   570
            Width           =   1140
         End
         Begin VB.TextBox TextAddQS 
            Height          =   270
            Left            =   840
            TabIndex        =   17
            Text            =   "TextAddQS"
            Top             =   915
            Width           =   2355
         End
         Begin VB.TextBox TextID 
            Appearance      =   0  'Flat
            Enabled         =   0   'False
            ForeColor       =   &H80000011&
            Height          =   270
            Left            =   4875
            TabIndex        =   16
            Text            =   "TextID"
            Top             =   930
            Width           =   1245
         End
         Begin VB.Label Label8 
            Caption         =   "班级名称"
            Height          =   180
            Left            =   60
            TabIndex        =   29
            Top             =   270
            Width           =   825
         End
         Begin VB.Label Label9 
            Caption         =   "专业名称"
            Height          =   180
            Left            =   2910
            TabIndex        =   28
            Top             =   300
            Width           =   750
         End
         Begin VB.Label Label10 
            Caption         =   "学号"
            Height          =   195
            Left            =   75
            TabIndex        =   27
            Top             =   615
            Width           =   480
         End
         Begin VB.Label Label11 
            Caption         =   "寝室电话"
            Height          =   165
            Left            =   2955
            TabIndex        =   26
            Top             =   615
            Width           =   810
         End
         Begin VB.Label Label12 
            Caption         =   "职务"
            Height          =   210
            Left            =   1335
            TabIndex        =   25
            Top             =   615
            Width           =   480
         End
         Begin VB.Label Label13 
            Caption         =   "寝室地址"
            Height          =   195
            Left            =   60
            TabIndex        =   24
            Top             =   930
            Width           =   870
         End
         Begin VB.Label Label17 
            Caption         =   "系统自动编号"
            ForeColor       =   &H80000011&
            Height          =   195
            Left            =   3630
            TabIndex        =   23
            Top             =   990
            Width           =   1230
         End
      End
      Begin VB.Frame Frame4 
         Caption         =   "个人信息"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   1035
         Left            =   120
         TabIndex        =   8
         Top             =   2685
         Width           =   6285
         Begin VB.TextBox TextFAdd 
            Height          =   270
            Left            =   885
            TabIndex        =   11
            Text            =   "TextFAdd"
            Top             =   240
            Width           =   5250
         End
         Begin VB.TextBox TextFTel 
            Height          =   270
            Left            =   885
            TabIndex        =   10
            Text            =   "TextFTel"
            Top             =   615
            Width           =   2160
         End
         Begin VB.TextBox TextYB 
            Height          =   270
            Left            =   4665
            TabIndex        =   9
            Text            =   "TextYB"
            Top             =   615
            Width           =   1455
         End
         Begin VB.Label Label14 
            Caption         =   "家庭地址"
            Height          =   195
            Left            =   105
            TabIndex        =   14
            Top             =   285
            Width           =   840
         End
         Begin VB.Label Label15 
            Caption         =   "家庭电话"
            Height          =   165
            Left            =   105
            TabIndex        =   13
            Top             =   645
            Width           =   810
         End
         Begin VB.Label Label16 
            Caption         =   "家庭邮编"
            Height          =   195
            Left            =   3645
            TabIndex        =   12
            Top             =   660
            Width           =   975
         End
      End
      Begin VB.Frame Frame5 
         Caption         =   "其他信息"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   1980
         Left            =   105
         TabIndex        =   1
         Top             =   3720
         Width           =   6315
         Begin VB.TextBox TextSR 
            Height          =   270
            Left            =   510
            TabIndex        =   4
            Text            =   "TextSR"
            Top             =   270
            Width           =   1410
         End
         Begin VB.TextBox TextAH 
            Height          =   270
            Left            =   2970
            TabIndex        =   3
            Text            =   "TextAH"
            Top             =   270
            Width           =   3120
         End
         Begin VB.TextBox TextIntro 
            Height          =   1035
            Left            =   45
            TabIndex        =   2
            Text            =   "TextIntro"
            Top             =   870
            Width           =   6210
         End
         Begin VB.Label Label18 
            Caption         =   "生日"
            Height          =   240
            Left            =   105
            TabIndex        =   7
            Top             =   330
            Width           =   435
         End
         Begin VB.Label Label19 
            Caption         =   "兴趣爱好"
            Height          =   210
            Left            =   2175
            TabIndex        =   6
            Top             =   300
            Width           =   855
         End
         Begin VB.Label Label20 
            Caption         =   "备注"
            Height          =   180
            Left            =   90
            TabIndex        =   5
            Top             =   645
            Width           =   540
         End
      End
      Begin VB.Image ComAdd 
         Height          =   360
         Left            =   5415
         Picture         =   "ForAdd.frx":0000
         Top             =   5730
         Width           =   990
      End
   End
End
Attribute VB_Name = "ForAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Nodx As Node              '注释:全局变量

Private Sub ComAdd_Click()
Dim I As Integer                         '注释:局部变量 I 为数值型.
Dim K As Integer                         '注释:局部变量 k 为数值型.
Dim Temp As String                       '注释:局部变量 Temp 为字符型.
On Error GoTo errhandle:
        
  If TextName.Text <> "" Then '注释:检查用户名是否为空
    
           '注释:查找用户
           Adodc1.Refresh
           Adodc1.Recordset.MoveFirst '指向第一条记录
           Temp = 0
           For K = 1 To Adodc1.Recordset.RecordCount  '记录的数量.
               If TextName.Text = Adodc1.Recordset("姓名") Then
                  Temp = 1
                  MsgBox ("该同学的资料已经存在!")
                  Exit Sub                 '注释:跳出Sub
               End If
               Adodc1.Recordset.MoveNext   '注释:指向下一条记录
               DoEvents
           Next K
 '------------------------------------------------------------------------
           If Temp = 0 Then
              Adodc1.Recordset.MoveLast
              Adodc1.Recordset.AddNew
              Adodc1.Recordset("姓名") = TextName.Text
              If Option1.Value = True Then
                 Adodc1.Recordset("性别") = "男"
              Else
                 Adodc1.Recordset("性别") = "女"
              End If
              If Option3.Value = True Then
                 Adodc1.Recordset("资料公开") = True
              Else
                 Adodc1.Recordset("资料公开") = False
              End If
              Adodc1.Recordset("固定电话") = TextTel.Text
              Adodc1.Recordset("移动手机") = TextMo.Text
              Adodc1.Recordset("电子邮箱") = TextEMail.Text
              Adodc1.Recordset("QQ号码") = TextQQ.Text
              Adodc1.Recordset("创建者") = ForMain.TextMain.Text
              Adodc1.Recordset.Update     '注释:保存记录
              DoEvents
           End If
           Adodc1.Recordset.MoveLast
           DoEvents
           TextID.Text = Adodc1.Recordset("ID")
 '------------------------------------------------------------------------
           Adodc2.Refresh
           Adodc2.Recordset.MoveLast       '注释:指向最后一条记录
           Adodc2.Recordset.AddNew         '添加记录.
           Adodc2.Recordset("ID") = TextID.Text
           Adodc2.Recordset("班级名称") = TextClass.Text
           Adodc2.Recordset("专业名称") = TextZY.Text
           Adodc2.Recordset("学号") = TextNum.Text
           Adodc2.Recordset("寝室电话") = TextZW.Text
           Adodc2.Recordset("寝室地址") = TextTelQS.Text
           Adodc2.Recordset("职务") = TextAddQS.Text
           Adodc2.Recordset.Update        '注释:保存记录
           DoEvents
 '------------------------------------------------------------------------
           Adodc3.Refresh
           Adodc3.Recordset.MoveLast       '注释:指向最后一条记录
           Adodc2.Recordset.AddNew         '添加记录.
           Adodc3.Recordset("ID") = TextID.Text
           Adodc3.Recordset("家庭地址") = TextFAdd.Text
           Adodc3.Recordset("家庭电话") = TextFTel.Text
           Adodc3.Recordset("家庭邮编") = TextYB.Text
           Adodc3.Recordset.Update        '注释:保存记录
           DoEvents

 '------------------------------------------------------------------------
           Adodc4.Refresh
           Adodc4.Recordset.MoveLast       '注释:指向最后一条记录
           Adodc4.Recordset.AddNew         '添加记录.
           Adodc4.Recordset("ID") = TextID.Text
           Adodc4.Recordset("生日") = TextSR.Text
           Adodc4.Recordset("兴趣爱好") = TextAH.Text
           Adodc4.Recordset("备注") = TextIntro.Text
           Adodc4.Recordset.Update        '注释:保存记录
           DoEvents
 '------------------------------------------------------------------------
  Else
    MsgBox ("用户名不能为空!")
    Exit Sub
  End If

  MsgBox ("添加成功!")
  
  Set Nodx = ForMain.TreeView.Nodes.Add("我的通信录", tvwChild, "|" & TextID.Text, TextName.Text)
  
  Unload Me
Exit Sub
errhandle:
    MsgBox Err.Description
    
End Sub

Private Sub Form_Load()


    '--------------------------------------------------------------------------

    With Adodc1               '注释:'连接到数据库
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Jing.mdb;Mode=ReadWrite;Persist Security Info=False"
        .CommandType = adCmdTable
        .RecordSource = "基本信息"
             '注释:连接到表"基本信息"
        .Refresh
             '注释:刷新
    End With

    With Adodc2               '注释:'连接到数据库
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Jing.mdb;Mode=ReadWrite;Persist Security Info=False"
        .CommandType = adCmdTable
        .RecordSource = "学生信息"
             '注释:连接到表"学生信息"
        .Refresh
             '注释:刷新
    End With

    With Adodc3               '注释:'连接到数据库
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Jing.mdb;Mode=ReadWrite;Persist Security Info=False"
        .CommandType = adCmdTable
        .RecordSource = "个人信息"
             '注释:连接到表"个人信息"
        .Refresh
             '注释:刷新
    End With
    
    With Adodc4               '注释:'连接到数据库
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Jing.mdb;Mode=ReadWrite;Persist Security Info=False"
        .CommandType = adCmdTable
        .RecordSource = "其他信息"
             '注释:连接到表"其他信息"
        .Refresh
             '注释:刷新
    End With
    
    '--------------------------------------------------------------------------
    TextName.Text = ""
    TextTel.Text = "-"
    TextMo.Text = "-"
    TextEMail.Text = "-"
    TextQQ.Text = "-"
    TextID.Text = ""
    TextClass.Text = "-"
    TextZY.Text = "-"
    TextNum.Text = "-"
    TextZW.Text = "无官无职"
    TextTelQS.Text = "-"
    TextAddQS.Text = "-"
    TextFAdd.Text = "-"
    TextFTel.Text = "-"
    TextYB.Text = "-"
    TextSR.Text = "不知道"
    TextAH.Text = "-"
    TextIntro.Text = "想要我说什么呢?"
    Option1.Value = True
    Option3.Value = True
    '--------------------------------------------------------------------------
End Sub

⌨️ 快捷键说明

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