📄 frmdevicetype.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form FrmDeviceType
Caption = "设备类型"
ClientHeight = 4755
ClientLeft = 60
ClientTop = 450
ClientWidth = 6375
Icon = "FrmDeviceType.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4755
ScaleWidth = 6375
StartUpPosition = 2 '屏幕中心
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2295
Left = 0
TabIndex = 6
Top = 840
Width = 6375
_ExtentX = 11245
_ExtentY = 4048
_Version = 393216
RowHeightMin = 315
WordWrap = -1 'True
HighLight = 0
FillStyle = 1
End
Begin VB.Frame Frame1
Caption = "编辑"
Height = 1455
Left = 120
TabIndex = 1
Top = 3240
Width = 6135
Begin VB.TextBox txtName
Height = 390
Left = 960
TabIndex = 5
Top = 720
Width = 2175
End
Begin VB.TextBox txtId
BackColor = &H80000011&
Enabled = 0 'False
Height = 390
Left = 960
TabIndex = 3
Top = 240
Width = 2175
End
Begin VB.Label Label3
Caption = "名称:"
Height = 255
Left = 240
TabIndex = 4
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "ID:"
Height = 255
Left = 240
TabIndex = 2
Top = 360
Width = 375
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 810
Left = 0
TabIndex = 0
Top = 0
Width = 6375
_ExtentX = 11245
_ExtentY = 1429
ButtonWidth = 1032
ButtonHeight = 1376
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新建"
Key = "新建"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "保存"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "删除"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "关闭"
Key = "关闭"
ImageIndex = 4
EndProperty
EndProperty
BorderStyle = 1
Begin MSComctlLib.ImageList ImageList1
Left = 4680
Top = 120
_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 = "FrmDeviceType.frx":08CA
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDeviceType.frx":11A4
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDeviceType.frx":1A7E
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDeviceType.frx":2358
Key = ""
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "FrmDeviceType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/09/25
'描 述:江苏大学网络信息中心网络管理系统 - v1.0 Beta
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Dim txtSQL As String
Dim MsgText As String
Dim HasError As Boolean
Private WithEvents mMSFlexGrid1 As cFlexGridBinder
Attribute mMSFlexGrid1.VB_VarHelpID = -1
Private Sub Form_Load()
Grid_Init
Grid_Fill
End Sub
Sub Grid_Init()
With MSFlexGrid1
.FormatString = "|<编号|<名称"
.ColWidth(0) = 0
.ColWidth(1) = 1000
.ColWidth(2) = 5200
.Rows = 1
End With
Set mMSFlexGrid1 = New cFlexGridBinder
With mMSFlexGrid1
Set .Grid = MSFlexGrid1
.Editable = True
.EditOnMouse = emeNone
.FullRowSelect = True
End With
End Sub
Sub Grid_Fill()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
txtSQL = "select * from tbl_devicetype"
Set rst = ExecuteSQL(txtSQL, MsgText, HasError)
MSFlexGrid1.Rows = 1
Do While Not rst.EOF
MSFlexGrid1.AddItem vbTab & rst.Fields("type_id") & vbTab & rst.Fields("type_name")
rst.MoveNext
Loop
End Sub
Private Sub MSFlexGrid1_Click()
If mMSFlexGrid1.HighlightedRow = 0 Then
Exit Sub
End If
txtId.Text = MSFlexGrid1.TextMatrix(mMSFlexGrid1.HighlightedRow, 1)
txtName.Text = MSFlexGrid1.TextMatrix(mMSFlexGrid1.HighlightedRow, 2)
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.key
Case "新建"
txtId.Text = ""
txtName.Text = ""
Case "保存"
If txtId.Text = "" Then
Set mrc = ExecuteSQL("select top 1 type_id from tbl_devicetype order by type_id desc", MsgText, HasError)
If mrc.EOF = False Then
newid = mrc.Fields("type_id") + 1
End If
txtSQL = "insert into tbl_devicetype values("
txtSQL = txtSQL & Quote(newid) & ","
txtSQL = txtSQL & Quote(txtName.Text)
txtSQL = txtSQL & ")"
Set mrc = ExecuteSQL(txtSQL, MsgText, HasError)
Else
txtSQL = "update tbl_devicetype set "
txtSQL = txtSQL & "type_name=" & Quote(txtName.Text)
txtSQL = txtSQL & " where type_id =" & Quote(txtId)
Set mrc = ExecuteSQL(txtSQL, MsgText, HasError)
End If
Grid_Fill
Case "删除"
Set mrc = ExecuteSQL("select top 1 * from tbl_device where type_id = " & Quote(txtId), MsgText, HasError)
If mrc.EOF = False Then
MsgBox "该类型尚有设备使用,无法删除!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = "delete from tbl_devicetype "
txtSQL = txtSQL & " where type_id =" & Quote(txtId)
Set mrc = ExecuteSQL(txtSQL, MsgText, HasError)
Grid_Fill
mMSFlexGrid1.HighlightedRow = 0
Case "关闭"
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -