📄 exorder.vb
字号:
Imports System
Imports System.Data
Imports System.Drawing
Imports System.Data.SqlClient
Public Class Form8
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
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 GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
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 TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.TextBox4 = New System.Windows.Forms.TextBox()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
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.Button2 = New System.Windows.Forms.Button()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.ComboBox1, Me.TextBox4, Me.TextBox3, Me.Label5, Me.Label4, Me.Label3, Me.TextBox2, Me.Label2, Me.TextBox1, Me.Label1})
Me.GroupBox1.Location = New System.Drawing.Point(8, 8)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(328, 200)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "外卖订单"
'
'Button1
'
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.ForeColor = System.Drawing.Color.Navy
Me.Button1.Location = New System.Drawing.Point(264, 21)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(48, 24)
Me.Button1.TabIndex = 10
Me.Button1.Text = "确定"
'
'ComboBox1
'
Me.ComboBox1.Location = New System.Drawing.Point(96, 168)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(216, 20)
Me.ComboBox1.TabIndex = 9
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(96, 117)
Me.TextBox4.Multiline = True
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(216, 40)
Me.TextBox4.TabIndex = 8
Me.TextBox4.Text = ""
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(96, 86)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(216, 21)
Me.TextBox3.TabIndex = 7
Me.TextBox3.Text = ""
'
'Label5
'
Me.Label5.ForeColor = System.Drawing.Color.Navy
Me.Label5.Location = New System.Drawing.Point(16, 167)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(72, 24)
Me.Label5.TabIndex = 6
Me.Label5.Text = "送货人"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label4
'
Me.Label4.ForeColor = System.Drawing.Color.Navy
Me.Label4.Location = New System.Drawing.Point(8, 117)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(80, 24)
Me.Label4.TabIndex = 5
Me.Label4.Text = "所送货物清单"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label3
'
Me.Label3.ForeColor = System.Drawing.Color.Navy
Me.Label3.Location = New System.Drawing.Point(16, 86)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 24)
Me.Label3.TabIndex = 4
Me.Label3.Text = "送货时间"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(96, 55)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(216, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'Label2
'
Me.Label2.ForeColor = System.Drawing.Color.Navy
Me.Label2.Location = New System.Drawing.Point(16, 55)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 24)
Me.Label2.TabIndex = 2
Me.Label2.Text = "送货地点"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(96, 24)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(160, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Label1
'
Me.Label1.ForeColor = System.Drawing.Color.Navy
Me.Label1.Location = New System.Drawing.Point(16, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "订单编码"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Button2
'
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button2.ForeColor = System.Drawing.Color.Navy
Me.Button2.Location = New System.Drawing.Point(288, 216)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(48, 24)
Me.Button2.TabIndex = 1
Me.Button2.Text = "送货"
'
'Form8
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(344, 245)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.GroupBox1})
Me.Name = "Form8"
Me.Text = "扩展外卖送货服务"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim order As New ExOrder()
order.id = Trim(Me.TextBox1.Text)
If order.id = "" Then
Exit Sub
End If
Dim sqlstr As String
sqlstr = "SELECT * FROM OrderInfo WHERE orderid='" & Trim(Me.TextBox1.Text) & "'"
Dim ds As New DataSet()
ds.Clear()
ds = GetDataFromDB(sqlstr)
If Not ds Is Nothing Then
order.address = ds.Tables(0).Rows(0)("shipadress")
order.rdate = ds.Tables(0).Rows(0)("requiredate")
order.item = ds.Tables(0).Rows(0)("cargos")
Me.TextBox2.Text = order.address
Me.TextBox3.Text = order.rdate
Me.TextBox4.Text = order.item
Me.Button2.Enabled = True
End If
End Sub
Private Sub Form8_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.Button2.Enabled = False
Dim sqlstr As String
sqlstr = "SELECT ClerkID FROM CLerk"
Dim ds As New DataSet()
ds.Clear()
ds = GetDataFromDB(sqlstr)
If Not ds Is Nothing Then
Dim i As Integer
If ds.Tables(0).Rows.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
Me.ComboBox1.Items.Add(Trim(ds.Tables(0).Rows(i) _
("ClerkID").ToString))
Next
End If
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
If Me.ComboBox1.SelectedItem = "" Then
Exit Sub
End If
Dim sqlstr As String
sqlstr = "UPDATE OrderInfo SET shipdate='" & Trim(Now.ToShortDateString) & "'" & _
" WHERE orderid='" & Trim(Me.TextBox1.Text) & "'"
UpdateData(sqlstr)
Me.Button2.Enabled = False
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -