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

📄 form1.vb

📁 XML集成订单处理系统源代码.rar 注意:使用源代码时
💻 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

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

    '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.
    Friend WithEvents txtEmail As System.Windows.Forms.TextBox
    Friend WithEvents txtCountry As System.Windows.Forms.TextBox
    Friend WithEvents txtPostalCode As System.Windows.Forms.TextBox
    Friend WithEvents txtRegion As System.Windows.Forms.TextBox
    Friend WithEvents txtCity As System.Windows.Forms.TextBox
    Friend WithEvents txtCompanyName As System.Windows.Forms.TextBox
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents BtSave As System.Windows.Forms.Button
    Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
    Friend WithEvents txtShippMethod As System.Windows.Forms.TextBox
    Friend WithEvents txtQuantity As System.Windows.Forms.TextBox
    Friend WithEvents txtCustomerNo As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.txtEmail = New System.Windows.Forms.TextBox()
        Me.txtCountry = New System.Windows.Forms.TextBox()
        Me.txtPostalCode = New System.Windows.Forms.TextBox()
        Me.txtRegion = New System.Windows.Forms.TextBox()
        Me.txtCity = New System.Windows.Forms.TextBox()
        Me.txtShippMethod = New System.Windows.Forms.TextBox()
        Me.txtQuantity = New System.Windows.Forms.TextBox()
        Me.txtCompanyName = New System.Windows.Forms.TextBox()
        Me.txtCustomerNo = New System.Windows.Forms.TextBox()
        Me.Label11 = New System.Windows.Forms.Label()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.BtSave = New System.Windows.Forms.Button()
        Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog()
        Me.SuspendLayout()
        '
        'txtEmail
        '
        Me.txtEmail.Location = New System.Drawing.Point(200, 312)
        Me.txtEmail.Name = "txtEmail"
        Me.txtEmail.Size = New System.Drawing.Size(235, 21)
        Me.txtEmail.TabIndex = 22
        Me.txtEmail.Text = ""
        '
        'txtCountry
        '
        Me.txtCountry.Location = New System.Drawing.Point(200, 272)
        Me.txtCountry.Name = "txtCountry"
        Me.txtCountry.Size = New System.Drawing.Size(235, 21)
        Me.txtCountry.TabIndex = 23
        Me.txtCountry.Text = ""
        '
        'txtPostalCode
        '
        Me.txtPostalCode.Location = New System.Drawing.Point(200, 240)
        Me.txtPostalCode.Name = "txtPostalCode"
        Me.txtPostalCode.Size = New System.Drawing.Size(235, 21)
        Me.txtPostalCode.TabIndex = 20
        Me.txtPostalCode.Text = ""
        '
        'txtRegion
        '
        Me.txtRegion.Location = New System.Drawing.Point(200, 200)
        Me.txtRegion.Name = "txtRegion"
        Me.txtRegion.Size = New System.Drawing.Size(235, 21)
        Me.txtRegion.TabIndex = 21
        Me.txtRegion.Text = ""
        '
        'txtCity
        '
        Me.txtCity.Location = New System.Drawing.Point(200, 160)
        Me.txtCity.Name = "txtCity"
        Me.txtCity.Size = New System.Drawing.Size(235, 21)
        Me.txtCity.TabIndex = 26
        Me.txtCity.Text = ""
        '
        'txtShippMethod
        '
        Me.txtShippMethod.Location = New System.Drawing.Point(200, 128)
        Me.txtShippMethod.Name = "txtShippMethod"
        Me.txtShippMethod.Size = New System.Drawing.Size(389, 21)
        Me.txtShippMethod.TabIndex = 27
        Me.txtShippMethod.Text = ""
        '
        'txtQuantity
        '
        Me.txtQuantity.Location = New System.Drawing.Point(200, 88)
        Me.txtQuantity.Name = "txtQuantity"
        Me.txtQuantity.Size = New System.Drawing.Size(389, 21)
        Me.txtQuantity.TabIndex = 24
        Me.txtQuantity.Text = ""
        '
        'txtCompanyName
        '
        Me.txtCompanyName.Location = New System.Drawing.Point(200, 48)
        Me.txtCompanyName.Name = "txtCompanyName"
        Me.txtCompanyName.Size = New System.Drawing.Size(389, 21)
        Me.txtCompanyName.TabIndex = 25
        Me.txtCompanyName.Text = ""
        '
        'txtCustomerNo
        '
        Me.txtCustomerNo.Location = New System.Drawing.Point(200, 16)
        Me.txtCustomerNo.Name = "txtCustomerNo"
        Me.txtCustomerNo.Size = New System.Drawing.Size(389, 21)
        Me.txtCustomerNo.TabIndex = 18
        Me.txtCustomerNo.Text = ""
        '
        'Label11
        '
        Me.Label11.Location = New System.Drawing.Point(16, 320)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(164, 18)
        Me.Label11.TabIndex = 11
        Me.Label11.Text = "E-mail:"
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(16, 280)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(164, 18)
        Me.Label10.TabIndex = 9
        Me.Label10.Text = "国家:"
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(16, 248)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(164, 18)
        Me.Label9.TabIndex = 7
        Me.Label9.Text = "邮政编码:"
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(16, 208)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(164, 18)
        Me.Label8.TabIndex = 8
        Me.Label8.Text = "地区:"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(16, 176)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(164, 18)
        Me.Label7.TabIndex = 12
        Me.Label7.Text = "城市:"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(16, 136)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(164, 18)
        Me.Label6.TabIndex = 16
        Me.Label6.Text = "送货方式:"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(16, 96)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(164, 18)
        Me.Label5.TabIndex = 17
        Me.Label5.Text = "数量:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(16, 64)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(164, 18)
        Me.Label4.TabIndex = 15
        Me.Label4.Text = "公司名称:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(16, 24)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(164, 18)
        Me.Label2.TabIndex = 14
        Me.Label2.Text = "客户编号:"
        '
        'BtSave
        '
        Me.BtSave.Location = New System.Drawing.Point(488, 352)
        Me.BtSave.Name = "BtSave"
        Me.BtSave.Size = New System.Drawing.Size(88, 24)
        Me.BtSave.TabIndex = 30
        Me.BtSave.Text = "发送订单"
        '
        'SaveFileDialog1
        '
        Me.SaveFileDialog1.FileName = "doc1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(608, 389)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.BtSave, Me.txtEmail, Me.txtCountry, Me.txtPostalCode, Me.txtRegion, Me.txtCity, Me.txtShippMethod, Me.txtQuantity, Me.txtCompanyName, Me.txtCustomerNo, Me.Label11, Me.Label10, Me.Label9, Me.Label8, Me.Label7, Me.Label6, Me.Label5, Me.Label4, Me.Label2})
        Me.Name = "Form1"
        Me.Text = "虚拟订单发送系统"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Public ReadOnly Property DataFilename() As String
        Get
            Dim folder As String
            Return "C:\Order\Order.xml" '返回要保存的文件名
        End Get
    End Property


    Public Sub OrderFromForm(ByVal Order As Order)
        ' 拷贝文本框的内容
        Order.CustomerNo = txtCustomerNo.Text
        Order.CompanyName = txtCompanyName.Text
        Order.Quantity = txtQuantity.Text
        Order.ShippingMethod = txtShippMethod.Text
        Order.City = txtCity.Text
        Order.Region = txtRegion.Text
        Order.PostalCode = txtPostalCode.Text
        Order.Country = txtCountry.Text
        Order.Email = txtEmail.Text
    End Sub


    Private Sub BtSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtSave.Click
        Dim Order As New Order() '创建一个订单对象
        OrderFromForm(Order) '将条目信息拷贝到订单对象中
        Dim filename As String = DataFilename
        Order.SaveXmlFile(filename) '保存订单
        MsgBox("订单已被发送到  " & filename) '告知客户
    End Sub

End Class

⌨️ 快捷键说明

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