📄 form_cdlgl.frm
字号:
VERSION 5.00
Begin VB.Form Form_cdlgl
BorderStyle = 1 'Fixed Single
Caption = "菜大类管理"
ClientHeight = 5685
ClientLeft = 45
ClientTop = 375
ClientWidth = 9375
Icon = "Form_cdlgl.frx":0000
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5685
ScaleWidth = 9375
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "菜大类"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3735
Left = 4320
TabIndex = 4
Top = 720
Width = 4695
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 360
Locked = -1 'True
TabIndex = 8
Top = 1560
Width = 3975
End
Begin VB.CommandButton Command1
Caption = "增 加"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 360
TabIndex = 7
Top = 2760
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "修 改"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1800
TabIndex = 6
Top = 2760
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "删 除"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 3240
TabIndex = 5
Top = 2760
Width = 1095
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "菜大类"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 360
TabIndex = 9
Top = 960
Width = 900
End
End
Begin VB.CommandButton Command4
Caption = "确 定"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 6000
TabIndex = 3
Top = 4800
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "退 出"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 7680
TabIndex = 2
Top = 4800
Width = 1335
End
Begin VB.ListBox List1
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4335
Left = 360
TabIndex = 1
Top = 840
Width = 3735
End
Begin VB.CommandButton Command6
Caption = "放弃"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 4320
TabIndex = 0
Top = 4800
Width = 1335
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "菜大类"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 360
TabIndex = 10
Top = 360
Width = 900
End
End
Attribute VB_Name = "Form_cdlgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lianjie As New Connection
Dim cl As Recordset
Private Sub Command1_Click()
Text2.Locked = False
Text2 = ""
Text2.SetFocus
Command1.Enabled = False
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
List1.Enabled = False
End Sub
Private Sub Command2_Click()
If Text2.Text = "" Then
MsgBox "不能修改!请选择菜大类。", vbInformation, "提示"
Else
Text2.Locked = False
Command2.Enabled = False
Text2.SetFocus
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
List1.Enabled = False
End If
End Sub
Private Sub Command3_Click()
If Text2.Text = "" Then
MsgBox "不能删除!请选择菜大类。", vbInformation, "提示"
Else
Command3.Enabled = False
Command4.SetFocus
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
List1.Enabled = False
End If
End Sub
Private Sub Command4_Click()
If Trim(Text2.Text) <> "" Then
If Command1.Enabled Then
Else
cl.AddNew
cl.Fields("菜大类") = Trim(Text2.Text)
cl.Update
Call cyy
MsgBox "增加成功!", vbInformation, "提示"
End If
If Command2.Enabled Then
Else
cl.Fields("菜大类") = Trim(Text2.Text)
cl.Update
Call cyy
MsgBox "修改成功!", vbInformation, "提示"
End If
If Command3.Enabled Then
Else
cl.Delete
cl.Update
Call cyy
MsgBox "删除成功!", vbInformation, "提示"
End If
Text2.Locked = True
Text2.Text = ""
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command1.Visible = True
Command2.Visible = True
Command3.Visible = True
List1.Enabled = True
End If
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Command6_Click()
Text2.Locked = True
Text2.Text = ""
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command1.Visible = True
Command2.Visible = True
Command3.Visible = True
List1.Enabled = True
End Sub
Private Sub Form_Load()
With lianjie
.ConnectionString = dblianjie
.Open
End With
Call cyy
End Sub
Private Sub cyy()
Set cl = New Recordset
cl.CursorLocation = adUseClient
cl.CursorType = adOpenDynamic
cl.LockType = adLockOptimistic
cl.Open "select * from 菜大类 ", lianjie
cl.Sort = "编号"
List1.Clear
If cl.RecordCount > 0 Then
cl.MoveFirst
Do Until cl.EOF
List1.AddItem Trim(cl.Fields("菜大类"))
cl.MoveNext
Loop
End If
Text2 = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
lianjie.Close
Set lianjie = Nothing
End Sub
Private Sub List1_Click()
cl.MoveFirst
cl.Find "菜大类='" & Trim(List1.List(List1.ListIndex)) & "'"
Text2.Text = Trim(cl.Fields("菜大类"))
End Sub
Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command4.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -