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

📄 form1.frm

📁 VB编写的汽车训练场管理系统。可做毕业设计参考/
💻 FRM
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   BackColor       =   &H00C0C000&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录......"
   ClientHeight    =   2220
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4020
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2220
   ScaleWidth      =   4020
   ShowInTaskbar   =   0   'False
   Begin MSCommLib.MSComm MSComm1 
      Left            =   60
      Top             =   1020
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00C0C000&
      Caption         =   "取 消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   600
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1530
      Width           =   1065
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00C0C000&
      Caption         =   "提 交"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2370
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1530
      Width           =   1065
   End
   Begin VB.TextBox Text2 
      BackColor       =   &H00404040&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1230
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   930
      Width           =   1905
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00404040&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   375
      Left            =   1230
      TabIndex        =   2
      Top             =   360
      Width           =   1905
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BackColor       =   &H000000FF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Label3"
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   420
      TabIndex        =   6
      Top             =   1920
      Visible         =   0   'False
      Width           =   3105
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密  码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   150
      TabIndex        =   1
      Top             =   960
      Width           =   1035
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   150
      TabIndex        =   0
      Top             =   420
      Width           =   1020
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim RS As New ADODB.Recordset
Private Sub Command1_Click()
   On Error Resume Next
   Dim i As Integer
   Dim FWQ(1 To 3) As String
  ' Yz
   Label3.Visible = True
   Label3.Caption = "正在连接服务器....."
   Label3.Refresh
   Open App.Path & "\pic\sp.jpg" For Input As #1
   Input #1, FWQ(1)
   Input #1, FWQ(2)
   Input #1, FWQ(3)
   Close #1
   Err.Clear
   If Cn.State = 0 Then
           Cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=" & FWQ(2) & ";Initial Catalog=sf;Data Source=" & FWQ(1) & ";Password=" & FWQ(3)
           Cn.Open
   End If
   If Err.Number Then
          MsgBox Err.Description & Chr(13) & "     服务器连接失败" & Chr(13) & Chr(13) & "★★★★★★★★★★★★" & Chr(13) & Chr(13) & "   请配置好后重新启动", 0 + vbCritical, "天鹰提示"
          Label3.Visible = False
          Exit Sub
   End If
   Label3.Caption = "正在验证信息....."
   Label3.Refresh
   RS.CursorLocation = adUseClient
   RS.Open "select * from yf where yf='" & Trim(Text1.Text) & "' and ma=" & MaJz(Trim(Text2.Text)), Cn, 1, 3
   If RS.RecordCount < 1 Then
      MsgBox "登录信息错误", 0 + vbCritical, "系统提示"
      RS.Close
      Label3.Visible = False
      Exit Sub
   End If
   For i = 1 To 8
     Qx(i) = Mid(RS("qx"), i, 1)
   Next
   Qxxx = RS("qx")
   RS.Close
   Yh = Trim(Text1.Text)
   Ma = Trim(Text2.Text)
   Dlsj = format(Time, "hh:nn:ss")
   RS.Open "select getdate() from yf", Cn, 1, 3
   Date = Mid(RS(0), 1, InStr(RS(0), " ") - 1)
   Time = Mid(RS(0), InStr(RS(0), " ") + 1)
   RS.Close
   Unload Me
End Sub

Private Sub Command2_Click()
 If MsgBox("退出本系统吗", 1 + 32, "系统提示") = vbOK Then
    End
 Else
    Unload Me
 End If
End Sub

Private Sub Form_Load()
 Me.Left = (MDIForm1.Width - Me.Width) / 2
 Me.Top = (MDIForm1.Height - Me.Height) / 2 - 3000
 Me.Show
 Text1.SetFocus
 MSComm1.CommPort = Yj(5) '串口号,
 MSComm1.Settings = "9600,N,8,1" '串口的属性
 MSComm1.InputLen = 0 '接收缓冲区的大小
 MSComm1.InputMode = comInputModeBinary '二进制接受方式
 MSComm1.RThreshold = 7 '每7个字节响应消息
 MSComm1.PortOpen = True '打开通信串口
End Sub

Private Sub Form_Unload(Cancel As Integer)
   MSComm1.PortOpen = False
End Sub

Private Sub MSComm1_OnComm()
   Dim Buffer As Variant '存储数据的缓冲区
   Dim CardNumber As Long '卡号
   Select Case MSComm1.CommEvent '串口事件
          Case comEvReceive '接收到数据
          Buffer = MSComm1.Input '清理接收缓冲区,此时,接收的字节数已经为0
          CardNumber = CDec(Buffer(4)) * 2 ^ 16 + (Buffer(5) * 2 ^ 8) + Buffer(6) '单个字节数据左移
          Text1.Text = CardNumber
          Text2.Text = Mid(Text1.Text, 1, 4)
          Command1.SetFocus
   End Select
  
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then Text2.SetFocus
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then Command1_Click
End Sub

⌨️ 快捷键说明

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