?? frmreport.vb
字號:
Public Class frmReport
Inherits System.Windows.Forms.Form
Private dtData As DataTable
#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 grbSearch As System.Windows.Forms.GroupBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents dgdList As System.Windows.Forms.DataGrid
Friend WithEvents btnPrint As System.Windows.Forms.Button
Friend WithEvents txbClass As System.Windows.Forms.TextBox
Friend WithEvents txbName As System.Windows.Forms.TextBox
Friend WithEvents txbId As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmReport))
Me.grbSearch = New System.Windows.Forms.GroupBox
Me.btnPrint = New System.Windows.Forms.Button
Me.Label3 = New System.Windows.Forms.Label
Me.txbClass = New System.Windows.Forms.TextBox
Me.txbName = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.txbId = New System.Windows.Forms.TextBox
Me.dgdList = New System.Windows.Forms.DataGrid
Me.grbSearch.SuspendLayout()
CType(Me.dgdList, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'grbSearch
'
Me.grbSearch.Controls.Add(Me.btnPrint)
Me.grbSearch.Controls.Add(Me.Label3)
Me.grbSearch.Controls.Add(Me.txbClass)
Me.grbSearch.Controls.Add(Me.txbName)
Me.grbSearch.Controls.Add(Me.Label2)
Me.grbSearch.Controls.Add(Me.Label1)
Me.grbSearch.Controls.Add(Me.txbId)
Me.grbSearch.Dock = System.Windows.Forms.DockStyle.Top
Me.grbSearch.Location = New System.Drawing.Point(0, 0)
Me.grbSearch.Name = "grbSearch"
Me.grbSearch.Size = New System.Drawing.Size(528, 39)
Me.grbSearch.TabIndex = 3
Me.grbSearch.TabStop = False
Me.grbSearch.Text = "學生信息"
'
'btnPrint
'
Me.btnPrint.Location = New System.Drawing.Point(368, 10)
Me.btnPrint.Name = "btnPrint"
Me.btnPrint.TabIndex = 7
Me.btnPrint.Text = "打印"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(248, 16)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(32, 15)
Me.Label3.TabIndex = 6
Me.Label3.Text = "班級"
'
'txbClass
'
Me.txbClass.Location = New System.Drawing.Point(280, 11)
Me.txbClass.Name = "txbClass"
Me.txbClass.ReadOnly = True
Me.txbClass.Size = New System.Drawing.Size(56, 21)
Me.txbClass.TabIndex = 5
Me.txbClass.Text = ""
'
'txbName
'
Me.txbName.Location = New System.Drawing.Point(184, 11)
Me.txbName.Name = "txbName"
Me.txbName.ReadOnly = True
Me.txbName.Size = New System.Drawing.Size(56, 21)
Me.txbName.TabIndex = 4
Me.txbName.Text = ""
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(152, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(32, 15)
Me.Label2.TabIndex = 3
Me.Label2.Text = "姓名"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(24, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(32, 15)
Me.Label1.TabIndex = 2
Me.Label1.Text = "學號"
'
'txbId
'
Me.txbId.Location = New System.Drawing.Point(56, 11)
Me.txbId.Name = "txbId"
Me.txbId.Size = New System.Drawing.Size(88, 21)
Me.txbId.TabIndex = 1
Me.txbId.Text = ""
'
'dgdList
'
Me.dgdList.CaptionVisible = False
Me.dgdList.DataMember = ""
Me.dgdList.Dock = System.Windows.Forms.DockStyle.Fill
Me.dgdList.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dgdList.Location = New System.Drawing.Point(0, 39)
Me.dgdList.Name = "dgdList"
Me.dgdList.Size = New System.Drawing.Size(528, 234)
Me.dgdList.TabIndex = 4
'
'frmReport
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(528, 273)
Me.Controls.Add(Me.dgdList)
Me.Controls.Add(Me.grbSearch)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmReport"
Me.Text = "打印成績單"
Me.grbSearch.ResumeLayout(False)
CType(Me.dgdList, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub txbId_KeyDown(ByVal sender As Object, ByVal _
e As System.Windows.Forms.KeyEventArgs) Handles txbId.KeyDown
If e.KeyCode = Keys.Enter And txbId.Text.Trim.Length <> 0 Then
Dim db As DataBase = New DataBase
Dim dv As DataView
Dim strSQL As String = "select 姓名, 班級名稱, 學籍編號 from"
strSQL += " 學生信息 as a, 班級信息 as b where a.班級編號="
strSQL += "b.班級編號 and 學號='" + Me.txbId.Text.Trim + "'"
dv = db.RunSelectSQL(strSQL)
If dv.Count = 0 Then
MessageBox.Show("學號錯誤!")
Exit Sub
End If
Me.txbName.Text = dv(0)("姓名").ToString()
Me.txbClass.Text = dv(0)("班級名稱").ToString()
strSQL = "select b.課程名稱,b.開課系別,b.教師,a.成績 from "
strSQL += "成績表 as a, 課程信息 as b where a.課程編號="
strSQL += "b.課程編號 and 學號='" + Me.txbId.Text.Trim
strSQL += " ' order by a.課程編號"
dv = db.RunSelectSQL(strSQL)
Me.dgdList.DataSource = dv
dv.AllowDelete = False
dv.AllowEdit = False
dv.AllowNew = False
dtData = dv.Table
Me.dgdList.AllowSorting = False
db.Dispose()
End If
End Sub
Private Sub btnPrint_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnPrint.Click
Dim childFrm As frmPrint = New frmPrint(dtData)
childFrm.ShowDialog()
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -