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

📄 frmaddstinfo.vb

📁 是一套开发的VB的学生成绩管理系统,希望有需要的人去参考
💻 VB
字号:
Imports System.Data.SqlClient
Public Class frmaddstinfo
    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 Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents txtsid As System.Windows.Forms.TextBox
    Friend WithEvents txtname As System.Windows.Forms.TextBox
    Friend WithEvents Combosex As System.Windows.Forms.ComboBox
    Friend WithEvents txtborndate As System.Windows.Forms.TextBox
    Friend WithEvents Comboclassno As System.Windows.Forms.ComboBox
    Friend WithEvents txttel As System.Windows.Forms.TextBox
    Friend WithEvents txtrudate As System.Windows.Forms.TextBox
    Friend WithEvents txtaddress As System.Windows.Forms.TextBox
    Friend WithEvents txtcomment As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.Label9 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.txtsid = New System.Windows.Forms.TextBox
        Me.txtname = New System.Windows.Forms.TextBox
        Me.Combosex = New System.Windows.Forms.ComboBox
        Me.Comboclassno = New System.Windows.Forms.ComboBox
        Me.txtborndate = New System.Windows.Forms.TextBox
        Me.txttel = New System.Windows.Forms.TextBox
        Me.txtrudate = New System.Windows.Forms.TextBox
        Me.txtaddress = New System.Windows.Forms.TextBox
        Me.txtcomment = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(32, 23)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "学号"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(184, 24)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(32, 23)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "姓名"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(8, 64)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(32, 23)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "性别"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(160, 64)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(56, 23)
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "出生日期"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(8, 104)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(32, 23)
        Me.Label5.TabIndex = 4
        Me.Label5.Text = "班级"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(160, 104)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(56, 23)
        Me.Label6.TabIndex = 5
        Me.Label6.Text = "联系电话"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(0, 136)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(56, 23)
        Me.Label7.TabIndex = 6
        Me.Label7.Text = "入校时间"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(200, 136)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(56, 23)
        Me.Label8.TabIndex = 7
        Me.Label8.Text = "家庭住址"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(8, 184)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(32, 23)
        Me.Label9.TabIndex = 8
        Me.Label9.Text = "备注"
        Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(216, 184)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 9
        Me.Button1.Text = "确认"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(320, 184)
        Me.Button2.Name = "Button2"
        Me.Button2.TabIndex = 10
        Me.Button2.Text = "取消"
        '
        'txtsid
        '
        Me.txtsid.Location = New System.Drawing.Point(56, 24)
        Me.txtsid.Name = "txtsid"
        Me.txtsid.TabIndex = 11
        Me.txtsid.Text = ""
        '
        'txtname
        '
        Me.txtname.Location = New System.Drawing.Point(232, 24)
        Me.txtname.Name = "txtname"
        Me.txtname.TabIndex = 12
        Me.txtname.Text = ""
        '
        'Combosex
        '
        Me.Combosex.Items.AddRange(New Object() {"男", "女"})
        Me.Combosex.Location = New System.Drawing.Point(56, 64)
        Me.Combosex.Name = "Combosex"
        Me.Combosex.Size = New System.Drawing.Size(40, 20)
        Me.Combosex.TabIndex = 13
        '
        'Comboclassno
        '
        Me.Comboclassno.Items.AddRange(New Object() {"一班", "二班", "三班", "四班", "五班"})
        Me.Comboclassno.Location = New System.Drawing.Point(56, 104)
        Me.Comboclassno.Name = "Comboclassno"
        Me.Comboclassno.Size = New System.Drawing.Size(88, 20)
        Me.Comboclassno.TabIndex = 14
        '
        'txtborndate
        '
        Me.txtborndate.Location = New System.Drawing.Point(232, 64)
        Me.txtborndate.Name = "txtborndate"
        Me.txtborndate.TabIndex = 15
        Me.txtborndate.Text = ""
        '
        'txttel
        '
        Me.txttel.Location = New System.Drawing.Point(232, 104)
        Me.txttel.Name = "txttel"
        Me.txttel.TabIndex = 16
        Me.txttel.Text = ""
        '
        'txtrudate
        '
        Me.txtrudate.Location = New System.Drawing.Point(56, 136)
        Me.txtrudate.Name = "txtrudate"
        Me.txtrudate.TabIndex = 17
        Me.txtrudate.Text = ""
        '
        'txtaddress
        '
        Me.txtaddress.Location = New System.Drawing.Point(272, 136)
        Me.txtaddress.Name = "txtaddress"
        Me.txtaddress.Size = New System.Drawing.Size(256, 21)
        Me.txtaddress.TabIndex = 18
        Me.txtaddress.Text = ""
        '
        'txtcomment
        '
        Me.txtcomment.Location = New System.Drawing.Point(56, 184)
        Me.txtcomment.Name = "txtcomment"
        Me.txtcomment.Size = New System.Drawing.Size(120, 21)
        Me.txtcomment.TabIndex = 19
        Me.txtcomment.Text = ""
        '
        'frmaddstinfo
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(536, 285)
        Me.Controls.Add(Me.txtcomment)
        Me.Controls.Add(Me.txtaddress)
        Me.Controls.Add(Me.txtrudate)
        Me.Controls.Add(Me.txttel)
        Me.Controls.Add(Me.txtborndate)
        Me.Controls.Add(Me.Comboclassno)
        Me.Controls.Add(Me.Combosex)
        Me.Controls.Add(Me.txtname)
        Me.Controls.Add(Me.txtsid)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "frmaddstinfo"
        Me.Text = "添加学籍信息"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not IsNumeric(Trim(txtsid.Text)) Then
            MsgBox("请输入数字!", vbOKOnly + vbExclamation, "警告")
            Exit Sub
        End If
        If Not IsNumeric(Trim(txttel.Text)) Then
            MsgBox("请输入数字!", vbOKOnly + vbExclamation, "警告")
            Exit Sub
        End If
        If Not IsDate(Trim(txtrudate.Text)) Then
            MsgBox("时间格式为(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告")
            txtrudate.Focus()
            Exit Sub
        End If
        If Not IsDate(Trim(txtborndate.Text)) Then
            MsgBox("时间格式为(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告")
            Exit Sub
        End If
        Dim tablename As String = "student"
        searchsql = "select * from student"
        Module1.executesql(searchsql, tablename)
        Dim newrow As DataRow
        newrow = Module1.mytable.NewRow
        newrow.Item(0) = Trim(txtsid.Text)
        newrow.Item(1) = Trim(txtname.Text)
        newrow.Item(2) = Trim(Combosex.SelectedItem)
        newrow.Item(3) = Trim(txtborndate.Text)
        newrow.Item(4) = Trim(Comboclassno.Text)
        newrow.Item(5) = Trim(txttel.Text)
        newrow.Item(6) = Trim(txtrudate.Text)
        newrow.Item(7) = Trim(txtaddress.Text)
        newrow.Item(8) = Trim(txtcomment.Text)
        mytable.Rows.Add(newrow)
        Module1.sqlcmd = New SqlCommandBuilder(Module1.sqladapter)
        Try
            Module1.sqladapter.Update(Module1.ds, tablename)
            MsgBox("添加成功", vbOKOnly + vbExclamation, "提示")
        Catch
            MsgBox(Err.Description)
        End Try
    End Sub

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

⌨️ 快捷键说明

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