📄 form1.vb
字号:
Imports System.Data.SqlClient
Imports Microsoft.Win32
Public Class Form1
Inherits System.Windows.Forms.Form
Dim from2 As New Form2
Dim conn As New SqlConnection("packet size=4096;integrated security=SSPI;initial catalog=keyanguanli")
Dim ds As New DataSet
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
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 TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents cb1 As System.Windows.Forms.GroupBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.cb1 = New System.Windows.Forms.GroupBox
Me.Button2 = New System.Windows.Forms.Button
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.cb1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("仿宋_GB2312", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Red
Me.Label1.Location = New System.Drawing.Point(120, 40)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(216, 32)
Me.Label1.TabIndex = 0
Me.Label1.Text = "高校科研管理系统"
'
'cb1
'
Me.cb1.Controls.Add(Me.Button2)
Me.cb1.Controls.Add(Me.Button1)
Me.cb1.Controls.Add(Me.TextBox2)
Me.cb1.Controls.Add(Me.TextBox1)
Me.cb1.Controls.Add(Me.Label3)
Me.cb1.Controls.Add(Me.Label2)
Me.cb1.Location = New System.Drawing.Point(72, 120)
Me.cb1.Name = "cb1"
Me.cb1.Size = New System.Drawing.Size(304, 160)
Me.cb1.TabIndex = 1
Me.cb1.TabStop = False
Me.cb1.Text = "管理员登录"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(160, 120)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 5
Me.Button2.Text = "取 消"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(48, 120)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 4
Me.Button1.Text = "登 录"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(128, 80)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox2.Size = New System.Drawing.Size(112, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(128, 40)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(112, 21)
Me.TextBox1.TabIndex = 2
Me.TextBox1.Text = ""
'
'Label3
'
Me.Label3.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label3.Location = New System.Drawing.Point(40, 80)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 24)
Me.Label3.TabIndex = 1
Me.Label3.Text = "密 码:"
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(40, 48)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 23)
Me.Label2.TabIndex = 0
Me.Label2.Text = "帐 号:"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(104, 280)
Me.Label4.Name = "Label4"
Me.Label4.TabIndex = 2
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(272, 288)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(120, 23)
Me.Label5.TabIndex = 3
Me.Label5.Text = "例: admin admin"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(442, 316)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.cb1)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "Form1"
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text = "高校科研管理系统"
Me.cb1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
conn.Open()
Me.Label4.Text = "正在验证 ..."
Dim adp As New SqlDataAdapter("select * from 管理员 where 帐号='" & Trim(TextBox1.Text) & "'", conn)
adp.Fill(ds, "管理员")
conn.Close()
If ds.Tables("管理员").Rows(0).Item(1) = Trim(TextBox2.Text) Then
Me.from2.Label38.Text = ds.Tables("管理员").Rows(0).Item(3)
Me.from2.Label39.Text = ds.Tables("管理员").Rows(0).Item(0)
from2.Show()
Me.Visible = False
Else
MessageBox.Show("帐号或密码错误!", "错误提示!")
Me.Label4.Visible = False
End If
Catch ex As Exception
MessageBox.Show("帐号或密码错误!", " 错误提示!")
Me.Label4.Visible = False
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb1.Enter
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -