📄 frmmeal.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmMeal
BorderStyle = 1 'Fixed Single
Caption = "Meal Database"
ClientHeight = 6285
ClientLeft = 45
ClientTop = 435
ClientWidth = 9900
Icon = "frmMeal.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6285
ScaleWidth = 9900
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.ImageList ImageList2
Left = 4560
Top = 3360
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMeal.frx":0BC2
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMeal.frx":1014
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMeal.frx":18EE
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMeal.frx":21C8
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Height = 570
Left = 120
TabIndex = 1
Top = 120
Width = 9645
_ExtentX = 17013
_ExtentY = 1005
ButtonWidth = 1984
ButtonHeight = 1005
Appearance = 1
Style = 1
TextAlignment = 1
ImageList = "ImageList2"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 14
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Add"
Key = "Add"
ImageIndex = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Edit"
Key = "Edit"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Trash"
Key = "Trash"
ImageIndex = 2
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Close"
Key = "Close"
ImageIndex = 1
EndProperty
BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 3840
Top = 3360
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMeal.frx":2AA2
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView lv
Height = 5295
HelpContextID = 7
Left = 120
TabIndex = 0
ToolTipText = "Double Click to Edit"
Top = 840
WhatsThisHelpID = 7
Width = 9615
_ExtentX = 16960
_ExtentY = 9340
View = 3
Arrange = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
HotTracking = -1 'True
HoverSelection = -1 'True
TextBackground = -1 'True
_Version = 393217
SmallIcons = "ImageList1"
ForeColor = -2147483640
BackColor = 16761024
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Century Gothic"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Meal No."
Object.Width = 2207
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Type No."
Object.Width = 2081
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "Description"
Object.Width = 19474
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "Price"
Object.Width = 2118
EndProperty
End
End
Attribute VB_Name = "frmMeal"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public maroi As String
Private Sub Form_Load()
check_RS
rs.Open "select * from meal order by meal_no", Cnn
fill
End Sub
Public Sub fill()
check_RS
rs.Open "select * from meal order by meal_no", Cnn
Dim x As Integer
lv.ListItems.Clear
While Not rs.EOF
Set lst = lv.ListItems.Add(, , rs(0), , 1)
For x = 1 To 3
lst.SubItems(x) = rs(x)
Next x
rs.MoveNext
Wend
End Sub
Private Sub lv_DblClick()
Dim x As Integer
maroi = "edit"
frmMealData.data(0) = lv.SelectedItem.Text
frmMealData.Combo1 = frmMealData.data(1)
frmMealData.data(0).Locked = True
'frmMealData.Label1.Visible = False
For x = 1 To 3
frmMealData.data(x) = lv.SelectedItem.SubItems(x)
Next x
Load frmMealData
frmMealData.Show 1
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.key
'=======
Case "Add"
maroi = "add"
Load frmMealData
frmMealData.Show 1
'=======
Case "Edit"
Call lv_DblClick
'=======
Case "Trash"
On Error GoTo m
If MsgBox("Are you sure do you want to delete " & lv.SelectedItem.SubItems(1), vbYesNo) = vbYes Then
Cnn.Execute "delete from meal where meal_no = " & lv.SelectedItem.Text
rs.Requery 1
fill
End If
m:
'=======
Case "Close"
Unload Me
'=======
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -