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

📄 form5.vb

📁 教师管理系统
💻 VB
字号:
Imports System.IO
Imports System.Data.SqlClient
Imports System.Drawing.Imaging

Public Class frmTeacherTel
    Inherits System.Windows.Forms.Form

#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 TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents cmbName As System.Windows.Forms.Label
    Friend WithEvents cmbID As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.cmbName = New System.Windows.Forms.Label
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.cmbID = New System.Windows.Forms.Label
        Me.DataGrid1 = New System.Windows.Forms.DataGrid
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'TextBox2
        '
        Me.TextBox2.Location = New System.Drawing.Point(200, 24)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(64, 21)
        Me.TextBox2.TabIndex = 11
        Me.TextBox2.Text = ""
        '
        'cmbName
        '
        Me.cmbName.Location = New System.Drawing.Point(152, 24)
        Me.cmbName.Name = "cmbName"
        Me.cmbName.Size = New System.Drawing.Size(32, 24)
        Me.cmbName.TabIndex = 10
        Me.cmbName.Text = "姓名"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(64, 24)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(64, 21)
        Me.TextBox1.TabIndex = 9
        Me.TextBox1.Text = ""
        '
        'cmbID
        '
        Me.cmbID.Location = New System.Drawing.Point(24, 24)
        Me.cmbID.Name = "cmbID"
        Me.cmbID.Size = New System.Drawing.Size(32, 24)
        Me.cmbID.TabIndex = 8
        Me.cmbID.Text = "编号"
        '
        'DataGrid1
        '
        Me.DataGrid1.DataMember = ""
        Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DataGrid1.Location = New System.Drawing.Point(0, 56)
        Me.DataGrid1.Name = "DataGrid1"
        Me.DataGrid1.Size = New System.Drawing.Size(288, 144)
        Me.DataGrid1.TabIndex = 12
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(32, 232)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(64, 24)
        Me.Button1.TabIndex = 13
        Me.Button1.Text = "更新"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(144, 232)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(64, 24)
        Me.Button2.TabIndex = 14
        Me.Button2.Text = "退出"
        '
        'frmTeacherTel
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(292, 268)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.DataGrid1)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.cmbName)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.cmbID)
        Me.Name = "frmTeacherTel"
        Me.Text = "教师电话号码"
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region


Imports System.IO
Imports System.Data.SqlClient


    Public Class frmteachTel
        Inherits System.Windows.Forms.Form
#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 TextBox2 As System.Windows.Forms.TextBox
        Friend WithEvents Label2 As System.Windows.Forms.Label
        Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
        Friend WithEvents Label1 As System.Windows.Forms.Label
        Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
        Friend WithEvents Button1 As System.Windows.Forms.Button
        Friend WithEvents Button2 As System.Windows.Forms.Button
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.TextBox2 = New System.Windows.Forms.TextBox
            Me.Label2 = New System.Windows.Forms.Label
            Me.TextBox1 = New System.Windows.Forms.TextBox
            Me.Label1 = New System.Windows.Forms.Label
            Me.DataGrid1 = New System.Windows.Forms.DataGrid
            Me.Button1 = New System.Windows.Forms.Button
            Me.Button2 = New System.Windows.Forms.Button
            CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'TextBox2
            '
            Me.TextBox2.Location = New System.Drawing.Point(200, 24)
            Me.TextBox2.Name = "TextBox2"
            Me.TextBox2.Size = New System.Drawing.Size(64, 21)
            Me.TextBox2.TabIndex = 11
            Me.TextBox2.Text = ""
            '
            'Label2
            '
            Me.Label2.Location = New System.Drawing.Point(152, 24)
            Me.Label2.Name = "Label2"
            Me.Label2.Size = New System.Drawing.Size(32, 24)
            Me.Label2.TabIndex = 10
            Me.Label2.Text = "姓名"
            '
            'TextBox1
            '
            Me.TextBox1.Location = New System.Drawing.Point(64, 24)
            Me.TextBox1.Name = "TextBox1"
            Me.TextBox1.Size = New System.Drawing.Size(64, 21)
            Me.TextBox1.TabIndex = 9
            Me.TextBox1.Text = ""
            '
            'Label1
            '
            Me.Label1.Location = New System.Drawing.Point(24, 24)
            Me.Label1.Name = "Label1"
            Me.Label1.Size = New System.Drawing.Size(32, 24)
            Me.Label1.TabIndex = 8
            Me.Label1.Text = "编号"
            '
            'DataGrid1
            '
            Me.DataGrid1.DataMember = ""
            Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
            Me.DataGrid1.Location = New System.Drawing.Point(0, 56)
            Me.DataGrid1.Name = "DataGrid1"
            Me.DataGrid1.Size = New System.Drawing.Size(288, 144)
            Me.DataGrid1.TabIndex = 12
            '
            'Button1
            '
            Me.Button1.Location = New System.Drawing.Point(32, 232)
            Me.Button1.Name = "Button1"
            Me.Button1.Size = New System.Drawing.Size(64, 24)
            Me.Button1.TabIndex = 13
            Me.Button1.Text = "更新"
            '
            'Button2
            '
            Me.Button2.Location = New System.Drawing.Point(144, 232)
            Me.Button2.Name = "Button2"
            Me.Button2.Size = New System.Drawing.Size(64, 24)
            Me.Button2.TabIndex = 14
            Me.Button2.Text = "退出"
            '
            'Form5
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
            Me.ClientSize = New System.Drawing.Size(292, 268)
            Me.Controls.Add(Me.Button2)
            Me.Controls.Add(Me.Button1)
            Me.Controls.Add(Me.DataGrid1)
            Me.Controls.Add(Me.TextBox2)
            Me.Controls.Add(Me.Label2)
            Me.Controls.Add(Me.TextBox1)
            Me.Controls.Add(Me.Label1)
            Me.Name = "Form5"
            Me.Text = "教师电话号码"
            CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)

        End Sub

#End Region
        Dim sconnstring As String = "data source=(local);initial catalog=学校管理系统;integrated secury=sspi"
        Dim mycn As New SqlConnection
        Dim mydataAdapter As New SqlDataAdapter
        Dim mydataset As New DataSet

        Sub pageload(ByVal strid As String)
            Dim mysql As String = "select * from 教师电话号码表 where(编号=" & strid & " ) "
            Dim mycommand As New SqlCommand(mysql, mycn)
            mydataAdapter.SelectCommand = mycommand
            mycn.ConnectionString = sconnstring
            mycn.Open()
            mydataset.Clear()
            mydataAdapter.Fill(mydataset, "教师电话号码表")
            mycn.Close()
            Dim mytable As New DataTable
            mytable = mydataset.Tables("教师电话号码表")

            If mydataset Is Nothing Then

                Dim drow As DataRow
                drow = mytable.NewRow
                mytable.Rows.Add(drow)
                mytable.Rows(0)("编号") = 0
                mytable.Rows(0)("电话号码") = 0
                mytable.Rows(0)("备注") = 0

            End If
            dgtel.datasource = mytable

        End Sub


        Private Sub from5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                Dim strID As String
                mycn.ConnectionString = sconnstring
                mycn.Open()
                Dim scomm As New SqlCommand("select * from 教师基本情况表", mycn)
                Dim mydatareader As SqlDataReader
                mydatareader = scomm.ExecuteReader
                mydatareader.Read()
                cmbID.text = mydatareader.Item(0)
                cmbName.text = mydatareader.Item(1)
                cmbID.item.clear()
                cmbName.item.clear()
                strID = cmbID.text
                While mydatareader.Read
                    cmbID.items.add(mydatareader.Item(0))
                    cmbName.items.add(mydatareader.Item(1))

                End While
                mycn.Close()
                pageload(strID)

            Catch myinformation As SqlException
                MessageBox.Show(myinformation.Message)


            End Try
        End Sub
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Close()
        End Sub
    End Class

⌨️ 快捷键说明

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