📄 frm_tyhwgl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Frm_Tyhwgl
BorderStyle = 1 'Fixed Single
Caption = "托运货物管理"
ClientHeight = 3450
ClientLeft = 45
ClientTop = 330
ClientWidth = 5175
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3450
ScaleWidth = 5175
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 210
Top = 3705
Width = 1980
_ExtentX = 3493
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid Dgr_Sjll
Bindings = "Frm_Tyhwgl.frx":0000
Height = 1485
Left = 90
TabIndex = 15
Top = 1575
Width = 5010
_ExtentX = 8837
_ExtentY = 2619
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 330
Left = 4065
TabIndex = 14
Top = 3090
Width = 1035
End
Begin VB.CommandButton Cmd_Save
Caption = "保存"
Height = 330
Left = 1980
TabIndex = 13
Top = 3090
Width = 1035
End
Begin VB.CommandButton Cmd_Del
Caption = "删除"
Height = 330
Left = 3015
TabIndex = 3
Top = 3090
Width = 1035
End
Begin VB.CommandButton Cmd_Add
Caption = "添加"
Height = 330
Left = 945
TabIndex = 2
Top = 3090
Width = 1035
End
Begin VB.Frame Frame1
Caption = "托运货物信息"
Height = 1470
Left = 90
TabIndex = 1
Top = 75
Width = 5010
Begin VB.TextBox Text1
Height = 315
Index = 4
Left = 3330
TabIndex = 12
Top = 1035
Width = 1530
End
Begin VB.TextBox Text1
Height = 315
Index = 3
Left = 1020
TabIndex = 10
Top = 1020
Width = 1350
End
Begin VB.TextBox Text1
Height = 315
Index = 2
Left = 3330
TabIndex = 8
Top = 645
Width = 1530
End
Begin VB.TextBox Text1
Height = 315
Index = 1
Left = 1020
TabIndex = 0
Top = 615
Width = 1350
End
Begin VB.TextBox Text1
Height = 315
Index = 0
Left = 1020
Locked = -1 'True
TabIndex = 5
Top = 225
Width = 1350
End
Begin VB.Label Label5
Caption = "货物件数"
Height = 210
Left = 2490
TabIndex = 11
Top = 1110
Width = 900
End
Begin VB.Label Label4
Caption = "货物重量"
Height = 285
Left = 135
TabIndex = 9
Top = 1095
Width = 960
End
Begin VB.Label Label3
Caption = "托运单号"
Height = 285
Left = 150
TabIndex = 7
Top = 345
Width = 1080
End
Begin VB.Label Label2
Caption = "货物名称"
Height = 285
Left = 2475
TabIndex = 6
Top = 735
Width = 885
End
Begin VB.Label Label1
Caption = "货物编号"
Height = 240
Left = 150
TabIndex = 4
Top = 720
Width = 780
End
End
End
Attribute VB_Name = "Frm_Tyhwgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c
Private Sub Cmd_Add_Click()
For i = 1 To 4
Text1(i).Text = ""
Next i
Text1(1).SetFocus
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_del_Click()
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("Delete tb_Goods_hwzx from tb_Goods_hwzx where hwzx_hwid='" + Text1(1) + "' and hwzx_sqdh='" + Text1(0) + "'")
MsgBox "货物已被删除", 64, "提示信息"
End If
For i = 1 To 4
Text1(i).Text = ""
Next i
Call ShowData
Call DBGCon
End Sub
Private Sub Cmd_Save_Click()
On Error Resume Next
If Text1(0).Text = "" Or Text1(1).Text = "" Or Text1(2).Text = "" Then
MsgBox "重要信息不能为空", 64, "提示信息"
Else
AdoRs.Open "select * from tb_Goods_hwzx where hwzx_hwid='" + Text1(1) + "' and hwzx_sqdh='" + Text1(0) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该货物已经添加过", 64, "提示信息"
Else
c = MsgBox("确认保存信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into tb_Goods_hwzx values('" & Text1(1) & "','" & Text1(2) & "','" & Text1(0) & "'," & Text1(3) & "," & Text1(4) & ")")
MsgBox "数据保存成功", 64, "提示信息"
Adodc1.RecordSource = "select * from tb_Goods_hwzx where hwzx_sqdh='" + Text1(0) + "' order by hwzx_hwid"
Adodc1.Refresh
Call DBGCon
Cmd_Add.SetFocus
End If
End If
AdoRs.Close
End If
End Sub
Private Sub Dgr_Sjll_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(1).Text = Adodc1.Recordset.Fields("hwzx_hwid")
Text1(2).Text = Adodc1.Recordset.Fields("hwzx_hwmc")
Text1(0).Text = Adodc1.Recordset.Fields("hwzx_sqdh")
Text1(4).Text = Adodc1.Recordset.Fields("hwzx_hwjs")
Text1(3).Text = Adodc1.Recordset.Fields("hwzx_hwzl")
End If
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Text1(0).Text = TStrs
Call ShowData
Call DBGCon
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If Index >= 1 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index >= 1 And KeyCode = 13 Then Text1(Index + 1).SetFocus
If Index <= 4 And KeyCode = 38 Then Text1(Index - 1).SetFocus
If Index = 4 And KeyCode = 13 Then
Call Cmd_Save_Click
End If
End Sub
Private Sub ShowData()
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_Goods_hwzx where hwzx_sqdh='" + Text1(0).Text + "' order by hwzx_hwid"
Adodc1.Refresh
End Sub
Private Sub DBGCon()
Dgr_Sjll.Columns(0).Caption = "货物编号"
Dgr_Sjll.Columns(1).Caption = "货物名称"
Dgr_Sjll.Columns(2).Caption = "托运单号"
Dgr_Sjll.Columns(3).Caption = "重量"
Dgr_Sjll.Columns(4).Caption = "物件数量"
Dgr_Sjll.Columns(0).Width = 1000
Dgr_Sjll.Columns(1).Width = 1500
Dgr_Sjll.Columns(3).Width = 1000
Dgr_Sjll.Columns(4).Width = 1200
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -