📄 paizi.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form2
BorderStyle = 3 'Fixed Dialog
Caption = "品牌档案"
ClientHeight = 3930
ClientLeft = 45
ClientTop = 330
ClientWidth = 7080
FillStyle = 0 'Solid
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3930
ScaleWidth = 7080
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 5040
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 360
Visible = 0 'False
Width = 1575
End
Begin VB.Frame Frame2
Height = 735
Left = 120
TabIndex = 5
Top = 3000
Width = 6855
Begin VB.CommandButton Command5
Caption = "退 出"
Height = 375
Left = 5640
TabIndex = 10
Top = 240
Width = 975
End
Begin VB.CommandButton Command4
Caption = "删 除"
Height = 375
Left = 4290
TabIndex = 9
Top = 240
Width = 975
End
Begin VB.CommandButton Command3
Caption = "修 改"
Height = 375
Left = 2940
TabIndex = 8
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "保 存"
Height = 375
Left = 1590
TabIndex = 7
Top = 240
Width = 975
End
Begin VB.CommandButton Command1
Caption = "增 加"
Height = 375
Left = 240
TabIndex = 6
Top = 240
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "编辑区"
ForeColor = &H00800000&
Height = 975
Left = 120
TabIndex = 0
Top = 1800
Width = 6855
Begin VB.TextBox Text2
Height = 270
Left = 4200
TabIndex = 4
Text = "Text2"
Top = 472
Width = 2055
End
Begin VB.TextBox Text1
Height = 270
Left = 1200
TabIndex = 2
Text = "Text1"
Top = 472
Width = 1935
End
Begin VB.Label Label2
Caption = "隶属:"
ForeColor = &H000000FF&
Height = 255
Left = 3360
TabIndex = 3
Top = 480
Width = 615
End
Begin VB.Label Label1
Caption = "品牌:"
ForeColor = &H000000FF&
Height = 255
Left = 480
TabIndex = 1
Top = 480
Width = 615
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "Paizi.frx":0000
Height = 1695
Left = 120
TabIndex = 11
Top = 0
Width = 6855
_ExtentX = 12091
_ExtentY = 2990
_Version = 393216
FixedCols = 0
BackColor = -2147483647
ForeColor = 65535
BackColorBkg = 12632256
TextStyleFixed = 1
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rec As Integer
Public BZ As Integer
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text1.Enabled = True
Text2.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
Command3.Enabled = False
BZ = 1
Text1.SetFocus
End Sub
Private Sub Command2_Click()
If BZ = 1 Then
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "品牌内容不能为空", 0 + 16
Exit Sub
End If
Data1.Recordset.FindFirst "品牌=" + "'" + Text1.Text + "'"
If Data1.Recordset.NoMatch = False Then
MsgBox "品牌重复", 0 + 16
Exit Sub
End If
With Data1.Recordset
.AddNew
.Update
.Bookmark = .LastModified
.Edit
.Fields("品牌") = Text1.Text
.Fields("隶属") = Text2.Text
.Update
End With
End If
If BZ = 2 Then
With Data1.Recordset
.AbsolutePosition = rec
.Edit
.Fields("品牌") = Text1.Text
.Fields("隶属") = Text2.Text
.Update
End With
End If
Data1.Refresh
Text1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command3_Click()
Data1.Recordset.AbsolutePosition = rec
Text1.Text = Data1.Recordset.Fields("品牌")
Text2.Text = Data1.Recordset.Fields("隶属")
Text1.Enabled = True
Text2.Enabled = True
Command2.Enabled = True
BZ = 2
End Sub
Private Sub Command4_Click()
Dim msg As Long
msg = MsgBox("是否确认删除?", 1 + 32)
If msg = 1 Then
Data1.Recordset.AbsolutePosition = rec
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Data1_Reposition()
If Data1.Recordset.RecordCount > 0 Then
Command3.Enabled = True
Command4.Enabled = True
Else
Command3.Enabled = False
Command4.Enabled = False
End If
End Sub
Private Sub Form_Activate()
Data1.DatabaseName = App.Path + "\odb.dll"
Data1.RecordSource = "paizi"
Data1.Refresh
Text1.Text = ""
Text2.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Command4.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
End Sub
Private Sub MSFlexGrid1_Click()
rec = MSFlexGrid1.Row - 1
Command3.Enabled = True
Command4.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -