📄 frmlj.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 frmLJ
Caption = "车辆添加零件"
ClientHeight = 3270
ClientLeft = 60
ClientTop = 345
ClientWidth = 5040
ForeColor = &H80000001&
Icon = "frmLJ.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 3270
ScaleWidth = 5040
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1470
Left = 75
TabIndex = 5
Top = 1695
Width = 4785
_ExtentX = 8440
_ExtentY = 2593
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
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
ColumnWidth = 3374.929
EndProperty
BeginProperty Column01
ColumnWidth = 959.811
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "汽车零件信息"
ForeColor = &H80000007&
Height = 780
Left = 60
TabIndex = 0
Top = 45
Width = 4860
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3720
Top = -30
Visible = 0 'False
Width = 1320
_ExtentX = 2328
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = 12632256
ForeColor = -2147483647
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "零件表"
Caption = "浏览零件信息"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 300
Left = 3555
TabIndex = 4
Top = 330
Width = 1200
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 300
Left = 990
TabIndex = 3
Top = 330
Width = 1935
End
Begin VB.Image Image1
Height = 30
Left = 0
Top = 885
Width = 1005
End
Begin VB.Label Label2
Caption = "单价:"
Height = 210
Left = 3000
TabIndex = 2
Top = 330
Width = 540
End
Begin VB.Label Label1
Caption = "零件名称:"
Height = 225
Left = 105
TabIndex = 1
Top = 330
Width = 930
End
End
Begin VB.Image Imgcancel
Height = 330
Left = 3900
Picture = "frmLJ.frx":1C7A
Stretch = -1 'True
Top = 1245
Width = 945
End
Begin VB.Image Imgok
Height = 330
Left = 2940
Picture = "frmLJ.frx":5C8C
Stretch = -1 'True
Top = 1245
Width = 945
End
Begin VB.Image Imgdelete
Height = 330
Left = 1965
Picture = "frmLJ.frx":9C99
Stretch = -1 'True
Top = 1245
Width = 945
End
Begin VB.Image Imgupdate
Height = 330
Left = 1005
Picture = "frmLJ.frx":DCA8
Stretch = -1 'True
Top = 1245
Width = 945
End
Begin VB.Image Imgadd
Height = 330
Left = 60
Picture = "frmLJ.frx":11CC3
Stretch = -1 'True
Top = 1245
Width = 945
End
Begin VB.Image Imgexit
Height = 330
Left = 3915
Picture = "frmLJ.frx":15CC1
Stretch = -1 'True
Top = 900
Width = 945
End
Begin VB.Image Image2
Height = 330
Index = 3
Left = 2940
Picture = "frmLJ.frx":19C93
Stretch = -1 'True
Top = 900
Width = 945
End
Begin VB.Image Image2
Height = 330
Index = 2
Left = 1980
Picture = "frmLJ.frx":1DACD
Stretch = -1 'True
Top = 900
Width = 945
End
Begin VB.Image Image2
Height = 330
Index = 1
Left = 1020
Picture = "frmLJ.frx":217E3
Stretch = -1 'True
Top = 900
Width = 945
End
Begin VB.Image Image2
Height = 330
Index = 0
Left = 60
Picture = "frmLJ.frx":254CA
Stretch = -1 'True
Top = 900
Width = 945
End
End
Attribute VB_Name = "frmLJ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frmLJ
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:mraj
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Dim i As Integer
Private Sub Lockctl()
Text1.Enabled = False
Text2.Enabled = False
End Sub
Private Sub Unlockctl()
Text1.Enabled = True
Text2.Enabled = True
End Sub
Private Sub Form_Load()
'设置窗体大小
frmLJ.Width = 5160
frmLJ.Height = 3675
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb;Persist Security Info=False"
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub Image2_Click(Index As Integer)
On Error Resume Next
Select Case Index
Case 0
Adodc1.Recordset.MoveFirst
Case 1
If Adodc1.Recordset.BOF = False Then
Adodc1.Recordset.MovePrevious
Else
MsgBox "向前已经没有记录了!", , "车辆管理系统"
End If
Case 2
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveNext
Else
MsgBox "向后已经没有记录了!", , "车辆管理系统"
End If
Case 3
Adodc1.Recordset.MoveLast
End Select
Text1.Text = Adodc1.Recordset.Fields(0)
Text2.Text = Adodc1.Recordset.Fields(1)
End Sub
Private Sub Imgadd_Click() '增加
Unlockctl
Text1 = ""
Text2 = ""
Text1.SetFocus
Imgok.Enabled = True
Imgcancel.Enabled = True
Imgupdate.Enabled = False
Imgdelete.Enabled = False
i = 1
Adodc1.Enabled = False
End Sub
Private Sub Imgcancel_Click() ' 取消
On Error Resume Next '当没有添加数据的时候 处理异常
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
Lockctl
Imgcancel.Enabled = False
Imgok.Enabled = False
Imgadd.Enabled = True
Imgupdate.Enabled = True
Imgdelete.Enabled = True
Adodc1.Enabled = True
End Sub
Private Sub Imgdelete_Click() '删除
If MsgBox("您确实要删除记录吗?", vbOKCancel, "车辆管理系统") = vbOK Then
On Error Resume Next
' adoCon.Execute ("delete from 车辆违章表 where 零件名='" & Text1 & "'")
Adodc1.Recordset.Delete
MsgBox " 记录已删除!", , "车辆管理系统"
Adodc1.Refresh
End If
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Imgexit_Click() '退出
MDIForm1.Show
Unload Me
End Sub
Private Sub Imgok_Click() '确定
Select Case i
Case 1
If Text1 = "" Then
MsgBox "零件名称不能为空!", , "车辆管理系统"
Text1.SetFocus
Exit Sub
End If
If Text2 = "" Then
MsgBox "价格不能为空!", , "车辆管理系统"
Text2.SetFocus
Exit Sub
End If
Call main1
adoCon.Execute ("insert into 零件表 values ('" & Text1 & "','" & Text2 & "')")
MsgBox "记录添加成功!", , "车辆管理系统"
adoCon.Close
Case 2
Call main1
adoCon.Execute ("update 零件表 set 单价='" & Text2 & "'where 零件名='" + Text1.Text + "'")
MsgBox "记录修改成功!", , "车辆管理系统"
adoCon.Close
End Select
Lockctl
'设置控件状态
Imgok.Enabled = False
Imgcancel.Enabled = False
Imgadd.Enabled = True
Imgupdate.Enabled = True
Imgdelete.Enabled = True
Adodc1.Refresh
DataGrid1.Refresh
End Sub
Private Sub Imgupdate_Click() '修改
Unlockctl
i = 2
'设置控件状态
Text1.Enabled = False
Imgok.Enabled = True
Imgcancel.Enabled = True
Imgadd.Enabled = False
Imgdelete.Enabled = False
Adodc1.Enabled = False
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then Text2.SetFocus '按回车键Text2获得焦点
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, "0123456789" & Chr(8), True) '调用模块中的自定义函数
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -