📄 类别项目.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Dev_ItemSortAddItem
BorderStyle = 1 'Fixed Single
Caption = "设备类别项目选择"
ClientHeight = 5040
ClientLeft = 2850
ClientTop = 1575
ClientWidth = 5715
HelpContextID = 12008
Icon = "类别项目.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5040
ScaleWidth = 5715
Begin MSFlexGridLib.MSFlexGrid vsFlexGrid1
Height = 3945
Left = 75
TabIndex = 0
Top = 540
Width = 5565
_ExtentX = 9816
_ExtentY = 6959
_Version = 393216
Cols = 4
FixedCols = 0
FocusRect = 0
SelectionMode = 1
FormatString = "<编码 |^项目名称 |^选定 |^固定项"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 300
Left = 4520
TabIndex = 2
Top = 4640
Width = 1120
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Height = 300
Left = 3260
TabIndex = 1
Top = 4640
Width = 1120
End
Begin VB.Label SortCode
Caption = "Label2"
Height = 285
Left = 1080
TabIndex = 4
Top = 150
Width = 1605
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "设备类别:"
Height = 180
Left = 75
TabIndex = 3
Top = 160
Width = 810
End
End
Attribute VB_Name = "Dev_ItemSortAddItem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim add_item As New Recordset
Dim Item_TF()
Private Sub Command1_Click() '保存项目分类信息
On Error Resume Next
Dim SSql As String
Dim i As Integer: Dim CH As String
Dim aDo_list As New Recordset
With vsFlexGrid1
For i = 0 To .Rows - 1
If .TextMatrix(i, 2) = "√" Then
Set aDo_list = Cw_DataEnvi.DataConnect.Execute("select * from DEV_ItemSortList where isid=" & Val(SortCode.Tag) & " and itemcode='" & .TextMatrix(i, 0) & "'")
If aDo_list.RecordCount < 1 Then
SSql = "INSERT INTO DEV_ItemSortList(isid,itemcode,YNShow,tab,itemtop) VALUES (" & Val(SortCode.Tag) & ",'" & Trim(.TextMatrix(i, 0)) & "','1'," & i & ",0 )"
Cw_DataEnvi.DataConnect.Execute SSql
End If
aDo_list.Close
Else
Cw_DataEnvi.DataConnect.Execute "delete DEV_ItemSortList where isid=" & Val(SortCode.Tag) & " and itemcode='" & .TextMatrix(i, 0) & "'"
End If
Next i
Unload Me
End With
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate() '向网格填充项目信息
On Error Resume Next
Dim ado_Itemtf As New Recordset
Dim i As Integer
i = 1
Set add_item = Cw_DataEnvi.DataConnect.Execute("select * from DEV_Item")
vsFlexGrid1.Rows = add_item.RecordCount + 1
Do While Not add_item.EOF
vsFlexGrid1.TextMatrix(i, 0) = add_item!ItemCode
vsFlexGrid1.TextMatrix(i, 1) = Trim(add_item!ItemChineseName)
Set ado_Itemtf = Cw_DataEnvi.DataConnect.Execute("select * from DEV_ItemSortList where ItemCode='" & add_item!ItemCode & "' and isid=" & SortCode.Tag)
If ado_Itemtf.RecordCount > 0 Then
vsFlexGrid1.TextMatrix(i, 2) = "√"
Else
vsFlexGrid1.TextMatrix(i, 2) = ""
End If
ado_Itemtf.Close
If add_item!YNRoot = 1 Then
vsFlexGrid1.TextMatrix(i, 2) = "√"
vsFlexGrid1.TextMatrix(i, 3) = "√"
End If
add_item.MoveNext
i = i + 1
Loop
add_item.Close
End Sub
Private Sub vsFlexGrid1_DblClick() '选中项目
With vsFlexGrid1
If Trim(.TextMatrix(.Row, 3)) <> "" Then MsgBox "固定项目必须选定!", 16: Exit Sub
If .TextMatrix(.Row, 2) = "" Then
.TextMatrix(.Row, 2) = "√"
Else
.TextMatrix(.Row, 2) = ""
End If
End With
End Sub
Private Sub vsFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer) '选中项目
If KeyCode = 32 Then
vsFlexGrid1_DblClick
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -