欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

checkvalid.vb

需要在.net环境下运行需要安装框架
VB
字号:
Imports System.Data.OleDb
Public Class CheckValid
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写处置以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents tbUName As System.Windows.Forms.TextBox
    Friend WithEvents tbUPass As System.Windows.Forms.TextBox
    Friend WithEvents btnCancle As System.Windows.Forms.Button
    Friend WithEvents btnSure As System.Windows.Forms.Button
    Friend WithEvents btnExit As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.tbUName = New System.Windows.Forms.TextBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.tbUPass = New System.Windows.Forms.TextBox()
        Me.btnCancle = New System.Windows.Forms.Button()
        Me.btnSure = New System.Windows.Forms.Button()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.btnExit = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(22, 104)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(42, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "用户名"
        '
        'tbUName
        '
        Me.tbUName.Location = New System.Drawing.Point(142, 104)
        Me.tbUName.Name = "tbUName"
        Me.tbUName.Size = New System.Drawing.Size(128, 21)
        Me.tbUName.TabIndex = 1
        Me.tbUName.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(22, 152)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(42, 16)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "密码"
        '
        'tbUPass
        '
        Me.tbUPass.Location = New System.Drawing.Point(142, 147)
        Me.tbUPass.Name = "tbUPass"
        Me.tbUPass.PasswordChar = Microsoft.VisualBasic.ChrW(64)
        Me.tbUPass.Size = New System.Drawing.Size(128, 21)
        Me.tbUPass.TabIndex = 3
        Me.tbUPass.Text = ""
        '
        'btnCancle
        '
        Me.btnCancle.Location = New System.Drawing.Point(25, 192)
        Me.btnCancle.Name = "btnCancle"
        Me.btnCancle.TabIndex = 4
        Me.btnCancle.Text = "取消"
        '
        'btnSure
        '
        Me.btnSure.Location = New System.Drawing.Point(193, 192)
        Me.btnSure.Name = "btnSure"
        Me.btnSure.TabIndex = 5
        Me.btnSure.Text = "确定"
        '
        'Label3
        '
        Me.Label3.Font = New System.Drawing.Font("华文中宋", 24.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label3.Location = New System.Drawing.Point(40, 24)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(216, 48)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "小区管理系统"
        '
        'btnExit
        '
        Me.btnExit.Location = New System.Drawing.Point(109, 192)
        Me.btnExit.Name = "btnExit"
        Me.btnExit.TabIndex = 7
        Me.btnExit.Text = "退出"
        '
        'CheckValid
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(292, 237)
        Me.ControlBox = False
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnExit, Me.Label3, Me.btnSure, Me.btnCancle, Me.tbUPass, Me.Label2, Me.tbUName, Me.Label1})
        Me.Name = "CheckValid"
        Me.Text = "小区管理系统"
        Me.ResumeLayout(False)

    End Sub

#End Region
    '在窗体的初始化阶段进行数据库相关参数的初始化
    Private Sub CheckValid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\xqglxt.mdb"
        conn = New OleDbConnection(connStr)
    End Sub
    '验证用户是否合法
    Private Sub btnSure_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSure.Click
        Dim mySqlStr As String = "select * from myUser where uName= '" & tbUName.Text & "'and uPass= '" & tbUPass.Text & "'"
        Dim myDB As DbOpera = New DbOpera(mySqlStr)
        If myDB.checkValid() Then
            setRecord()
            Me.Close()
        Else
            MsgBox("hello", MsgBoxStyle.Exclamation, "error")
        End If
    End Sub
    '取消以前填入的值
    Private Sub btnCancle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancle.Click
        tbUName.Text = ""
        tbUPass.Text = ""
    End Sub

    Private Sub getInfo() '取得小区的信息

    End Sub
    Private Sub setRecord()
        Dim sqlStr As String
        sqlStr = "insert into operaRecord(orStartTime,uName) values('" & Date.Now.ToString() & "','"
        sqlStr = sqlStr & tbUName.Text & "')"
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        useStart = Date.Now.ToString()
        userName = tbUName.Text
        dbopera1.opera()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Application.Exit()
    End Sub
End Class

⌨️ 快捷键说明

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