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

📄 frmaddclient.frm

📁 使用vb开发的课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddClient 
   Caption         =   "添加客户信息"
   ClientHeight    =   3105
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5880
   LinkTopic       =   "Form1"
   ScaleHeight     =   3105
   ScaleWidth      =   5880
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&C)"
      Height          =   375
      Left            =   3240
      TabIndex        =   12
      Top             =   2520
      Width           =   1335
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加(&A)"
      Height          =   375
      Left            =   1200
      TabIndex        =   11
      Top             =   2520
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Caption         =   "客户信息"
      Height          =   2175
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5655
      Begin VB.TextBox txtClient 
         Height          =   615
         Index           =   4
         Left            =   1200
         TabIndex        =   10
         Text            =   "Text5"
         Top             =   1320
         Width           =   4215
      End
      Begin VB.TextBox txtClient 
         Height          =   285
         Index           =   3
         Left            =   3720
         TabIndex        =   8
         Text            =   "Text4"
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox txtClient 
         Height          =   285
         Index           =   2
         Left            =   1200
         TabIndex        =   7
         Text            =   "Text3"
         Top             =   840
         Width           =   1575
      End
      Begin VB.TextBox txtClient 
         Height          =   285
         Index           =   1
         Left            =   3840
         TabIndex        =   6
         Text            =   "Text2"
         Top             =   360
         Width           =   1575
      End
      Begin VB.TextBox txtClient 
         Height          =   285
         Index           =   0
         Left            =   1200
         TabIndex        =   5
         Text            =   "Text1"
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label5 
         Caption         =   "备注:"
         Height          =   255
         Left            =   600
         TabIndex        =   9
         Top             =   1320
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "E-mail:"
         Height          =   255
         Left            =   3120
         TabIndex        =   4
         Top             =   840
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "电话:"
         Height          =   255
         Left            =   600
         TabIndex        =   3
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "联  系  人:"
         Height          =   255
         Left            =   2880
         TabIndex        =   2
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "客户名称:"
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   1215
      End
   End
End
Attribute VB_Name = "frmAddClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public sqlStr As String
Public msgText As String

Private Sub cmdAdd_Click()
 Dim rstClient As ADODB.Recordset
 Dim i As Integer
  
 For i = 0 To 3
    If txtClient(i).Text = "" Then
    
       MsgBox "请将信息填写完整", vbOKOnly + vbExclamation, "警告"
 
       Exit Sub
    
    End If
 Next i

 '添加新记录
 sqlStr = "select * from client"
 Set rstClient = ExecuteSQL(sqlStr, msgText)
 rstClient.AddNew
 rstClient.Fields("clientName") = txtClient(0).Text
 rstClient.Fields("contact") = txtClient(1).Text
 rstClient.Fields("telno") = txtClient(2).Text
 rstClient.Fields("email") = txtClient(3).Text
 rstClient.Fields("memo") = txtClient(4).Text
 rstClient.Update
 rstClient.Close
     
 MsgBox "客户信息添加完成!", vbOKOnly + vbExclamation, "警告"
 
 clearTextBox
 

End Sub

Private Sub cmdCancel_Click()
Unload Me

End Sub

Sub clearTextBox()
Dim i As Integer
For i = 0 To 4
    txtClient(i).Text = ""
Next i
End Sub

Private Sub Form_Load()
clearTextBox
End Sub

⌨️ 快捷键说明

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