Option Strict Off
Imports System.Windows.Forms
Public Class 人員ID卡系統配置設定
    ReadOnly ds4 As New DataSet : ReadOnly ds1 As New DataSet
    Private Sub Set_人員清單()
        清單_dgv.DataSource = Nothing : ds1.Clear()
        清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        清單_dgv.ColumnHeadersHeight = 25
        清單_dgv.AllowUserToAddRows = False
        清單_dgv.RowTemplate.Height = 30

        SQL_人員ID卡系統配置設定_清單()
        da.Fill(ds1) : 清單_dgv.DataSource = ds1.Tables(0) : conn.Close()
        清單_dgv.Columns(0).FillWeight = 100 : 清單_dgv.Columns(1).FillWeight = 100 : 清單_dgv.Columns(2).FillWeight = 100 : 清單_dgv.Columns(3).FillWeight = 100
        清單_dgv.Columns(4).FillWeight = 100
    End Sub
    Private Sub 人員ID卡系統配置設定_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Set_人員清單() : 姓名_tb.Enabled = False : 帳號_tb.Enabled = False
        ID卡號_tb.Focus()
    End Sub
    Private Sub DataGridView2_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 清單_dgv.CellClick
        If e.RowIndex = -1 Then : Else
            姓名_tb.Text = 清單_dgv("姓名", e.RowIndex).Value.ToString : 帳號_tb.Text = 清單_dgv("帳號", e.RowIndex).Value.ToString
            ID卡號_tb.Focus()
        End If
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 卡片配對_bt.Click
        If 姓名_tb.Text = "" Or 帳號_tb.Text = "" Or ID卡號_tb.Text = "" Then
            MsgBox("輸入資料有誤。")
        Else
            SQL_人員ID卡系統配置設定_配卡() : conn.Close()
            MsgBox("卡片與系統帳號配對完成。") : ID卡號_tb.Text = ""
        End If
        Set_人員清單() : ID卡號_tb.Focus()
    End Sub
    Private Sub 清除_bt_Click(sender As Object, e As EventArgs) Handles 清除_bt.Click
        If 姓名_tb.Text = "" Or 帳號_tb.Text = "" Then
            MsgBox("輸入資料有誤。 Wrong input data.")
        Else
            ID卡號_tb.Text = "" : SQL_人員ID卡系統配置設定_配卡() : conn.Close()
            MsgBox("卡片綁定去除完成。") : ID卡號_tb.Text = ""
        End If
        Set_人員清單() : ID卡號_tb.Focus()
    End Sub
    Private Sub 字體_NUD_ValueChanged(sender As Object, e As EventArgs) Handles 字體_NUD.ValueChanged
        清單_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
    End Sub
End Class