📄 frmtypeedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmTypeEdit
Caption = "编辑类型信息"
ClientHeight = 2715
ClientLeft = 60
ClientTop = 345
ClientWidth = 3405
LinkTopic = "Form1"
ScaleHeight = 2715
ScaleWidth = 3405
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Cancel
Caption = "取 消"
Height = 375
Left = 2040
TabIndex = 7
Top = 2160
Width = 1095
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 375
Left = 240
TabIndex = 6
Top = 2160
Width = 1095
End
Begin VB.TextBox txtName
Height = 330
Left = 1560
TabIndex = 5
Top = 1485
Width = 1335
End
Begin VB.ComboBox cob_Level
Height = 300
Left = 1560
Style = 2 'Dropdown List
TabIndex = 1
Top = 300
Width = 1335
End
Begin MSDataListLib.DataCombo dco_Type
Height = 330
Left = 1560
TabIndex = 3
Top = 885
Width = 1335
_ExtentX = 2355
_ExtentY = 582
_Version = 393216
Style = 2
Text = ""
End
Begin MSAdodcLib.Adodc Ado_Type
Height = 375
Left = 0
Top = 0
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
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 = "Ado_Type"
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 VB.Label Label3
AutoSize = -1 'True
Caption = "类型名称"
Height = 180
Left = 600
TabIndex = 4
Top = 1560
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "选择一级类型"
Height = 180
Left = 240
TabIndex = 2
Top = 960
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "选择类型级别"
Height = 180
Left = 240
TabIndex = 0
Top = 360
Width = 1080
End
End
Attribute VB_Name = "FrmTypeEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriTId As Long
Public Modify As Boolean
Public OriTName As String
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
If Len(Trim(txtName)) = 0 Then
MsgBox "请输入类型名称"
txtName.SetFocus
Exit Sub
End If
If cob_Level.ListIndex = 1 And Trim(dco_Type.Text) = "" Then
MsgBox "请选择一级类型名称"
dco_Type.SetFocus
Exit Sub
End If
If Modify = False Then
'类型名称不允许重复
If MyType.In_DB(Trim(txtName)) = True Then
MsgBox "已经存在此类型名称"
txtName.SetFocus
Exit Sub
End If
Else
'判断类型名称是否修改,且修改后的类型名称是否存在
If OriTName <> Trim(txtName) Then
If MyType.In_DB(Trim(txtName)) = True Then
MsgBox "已经存在此类型名称"
txtName.SetFocus
Exit Sub
End If
End If
End If
With MyType
.TypeName = Trim(txtName)
If cob_Level.ListIndex = 0 Then
.UpperId = 0
Else
.UpperId = Val(dco_Type.BoundText())
End If
If Modify = False Then
.Insert
Else
.Update (OriTId)
End If
End With
Unload Me
End Sub
Private Sub cob_Level_Click()
'判断选中的是否为二级类型,如果是则显示一级类型信息
If cob_Level.ListIndex = 0 Then
dco_Type.Enabled = False
Else
dco_Type.Enabled = True
End If
End Sub
Private Sub Form_Load()
'装入类型级别
cob_Level.AddItem "一级类型", 0
cob_Level.AddItem "二级类型", 1
cob_Level.ListIndex = 0
'装入一级类型信息
Ado_Type.ConnectionString = Conn
Ado_Type.RecordSource = "Select * From Types Where UpperId=0"
Ado_Type.Refresh
Set dco_Type.RowSource = Ado_Type
dco_Type.ListField = "TypeName"
dco_Type.BoundColumn = "TypeId"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -