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

📄 form1.vb

📁 介绍vb.net的一本很好的英文资料,深入浅出,值得一读
💻 VB
字号:
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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
    Friend WithEvents lblInvoiceID As System.Windows.Forms.Label
    Friend WithEvents txtInvoiceID As System.Windows.Forms.TextBox
    Friend WithEvents lblCustomerID As System.Windows.Forms.Label
    Friend WithEvents txtCustomerID As System.Windows.Forms.TextBox
    Friend WithEvents lblAmount As System.Windows.Forms.Label
    Friend WithEvents txtAmount As System.Windows.Forms.TextBox
    Friend WithEvents btnFill As System.Windows.Forms.Button
    Friend WithEvents InvSchema1 As InvoiceApp.InvSchema

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.lblInvoiceID = New System.Windows.Forms.Label()
        Me.txtInvoiceID = New System.Windows.Forms.TextBox()
        Me.lblCustomerID = New System.Windows.Forms.Label()
        Me.txtCustomerID = New System.Windows.Forms.TextBox()
        Me.lblAmount = New System.Windows.Forms.Label()
        Me.txtAmount = New System.Windows.Forms.TextBox()
        Me.btnFill = New System.Windows.Forms.Button()
        Me.InvSchema1 = New InvoiceApp.InvSchema()
        CType(Me.InvSchema1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'lblInvoiceID
        '
        Me.lblInvoiceID.Location = New System.Drawing.Point(16, 24)
        Me.lblInvoiceID.Name = "lblInvoiceID"
        Me.lblInvoiceID.TabIndex = 0
        Me.lblInvoiceID.Text = "Invoice ID"
        '
        'txtInvoiceID
        '
        Me.txtInvoiceID.Location = New System.Drawing.Point(104, 24)
        Me.txtInvoiceID.Name = "txtInvoiceID"
        Me.txtInvoiceID.TabIndex = 1
        Me.txtInvoiceID.Text = ""
        '
        'lblCustomerID
        '
        Me.lblCustomerID.Location = New System.Drawing.Point(16, 56)
        Me.lblCustomerID.Name = "lblCustomerID"
        Me.lblCustomerID.TabIndex = 2
        Me.lblCustomerID.Text = "Customer ID"
        '
        'txtCustomerID
        '
        Me.txtCustomerID.Location = New System.Drawing.Point(104, 56)
        Me.txtCustomerID.Name = "txtCustomerID"
        Me.txtCustomerID.TabIndex = 3
        Me.txtCustomerID.Text = ""
        '
        'lblAmount
        '
        Me.lblAmount.Location = New System.Drawing.Point(16, 88)
        Me.lblAmount.Name = "lblAmount"
        Me.lblAmount.TabIndex = 4
        Me.lblAmount.Text = "Amount"
        '
        'txtAmount
        '
        Me.txtAmount.Location = New System.Drawing.Point(104, 88)
        Me.txtAmount.Name = "txtAmount"
        Me.txtAmount.TabIndex = 5
        Me.txtAmount.Text = ""
        '
        'btnFill
        '
        Me.btnFill.Location = New System.Drawing.Point(64, 128)
        Me.btnFill.Name = "btnFill"
        Me.btnFill.TabIndex = 6
        Me.btnFill.Text = "Fill"
        '
        'InvSchema1
        '
        Me.InvSchema1.DataSetName = "InvSchema"
        Me.InvSchema1.Locale = New System.Globalization.CultureInfo("en-US")
        Me.InvSchema1.Namespace = "http://tempuri.org/InvSchema.xsd"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(216, 165)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnFill, Me.txtAmount, Me.lblAmount, Me.txtCustomerID, Me.lblCustomerID, Me.txtInvoiceID, Me.lblInvoiceID})
        Me.Name = "Form1"
        Me.Text = "Form1"
        CType(Me.InvSchema1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnFill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFill.Click
        Dim sqlConn As New SqlClient.SqlConnection("Data Source=localhost;Initial Catalog=Cargo;Integrated Security=True;")
        sqlConn.Open()
        Dim sqlAdapt As New SqlClient.SqlDataAdapter("Select * from Invoices", sqlConn)
        Dim invTable As New InvSchema.InvoicesDataTable()
        sqlAdapt.Fill(InvSchema1, invTable.TableName)
        txtInvoiceID.Text = InvSchema1.Invoices(0).InvoiceID
        txtCustomerID.Text = InvSchema1.Invoices(0).CustomerID
        txtAmount.Text = InvSchema1.Invoices(0).Amount
    End Sub
End Class

⌨️ 快捷键说明

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