📄 dlgseltemplate.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form dlgSelTemplate
BackColor = &H80000018&
BorderStyle = 1 'Fixed Single
Caption = "选择数据字典"
ClientHeight = 5205
ClientLeft = 45
ClientTop = 435
ClientWidth = 7890
Icon = "dlgSelTemplate.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5205
ScaleWidth = 7890
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtResult
Height = 405
Left = 150
TabIndex = 0
Top = 3870
Width = 7575
End
Begin XPControls.XPCommandButton cmdCancel
Cancel = -1 'True
Height = 405
Left = 5760
TabIndex = 1
Top = 4530
Width = 1125
_ExtentX = 1984
_ExtentY = 714
Caption = "取 消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdClear
Height = 405
Left = 4110
TabIndex = 2
Top = 4530
Width = 1125
_ExtentX = 1984
_ExtentY = 714
Caption = "清 除"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComctlLib.ListView LvwTemplates
Height = 3405
Left = 150
TabIndex = 4
Top = 90
Width = 7575
_ExtentX = 13361
_ExtentY = 6006
View = 1
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = 16777152
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "现有数据字典"
Object.Width = 2822
EndProperty
End
Begin XPControls.XPCommandButton cmdOK
Height = 405
Left = 930
TabIndex = 5
Top = 4530
Width = 1125
_ExtentX = 1984
_ExtentY = 714
Caption = "确 定"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdAddToMB
Height = 405
Left = 2520
TabIndex = 6
Top = 4530
Width = 1125
_ExtentX = 1984
_ExtentY = 714
Caption = "添加到模板"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "返回结果:"
Height = 195
Left = 150
TabIndex = 3
Top = 3600
Width = 900
End
Begin ComctlLib.ImageList ImageList1
Left = 2895
Top = 3390
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 1
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "dlgSelTemplate.frx":1982
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "dlgSelTemplate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mblnOK As Boolean '用户单击了哪个按钮
Dim mstrSelTemplate As String
Private Sub cmdAddToMB_Click()
Dim strMaxID As String
Dim strSQL As String
Dim rstemp As ADODB.Recordset
Dim cmd As ADODB.Command
Set rstemp = New ADODB.Recordset
strSQL = "select * from DM_XM_Value where XMID='" & gXMIDForDM & "' and DMValue='" & TxtResult.Text & "'"
rstemp.Open strSQL, GCon, adOpenStatic, adLockReadOnly
If rstemp.RecordCount > 0 Then
MsgBox "该模板已存在", vbInformation, "提示"
Exit Sub
End If
strMaxID = GetMaxID("DM_XM_Value", "XMDMID", "00001")
strSQL = "insert into DM_XM_Value values('" & strMaxID & "'" _
& ",'" & gXMIDForDM & "','" & TxtResult.Text & "'"
strSQL = strSQL & "," & gintManagerID & ",'" & Date & "')"
'写入数据库
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = GCon
cmd.CommandText = strSQL
cmd.Execute
MsgBox "添加成功", vbInformation, "提示"
End Sub
Private Sub cmdCancel_Click()
mblnOK = False
Me.Hide
Unload Me
End Sub
Private Sub cmdClear_Click()
TxtResult.Text = ""
TxtResult.SetFocus
End Sub
Private Sub cmdOK_Click()
'如果没有模板,用户单击“确定”与单击“取消”相同
If lvwTemplates.ListItems.Count < 1 Then
cmdCancel_Click
Exit Sub
End If
'提示用户选择
If Trim(TxtResult.Text) = "" Then
MsgBox "请选择模板!", vbInformation, "提示"
Exit Sub
End If
mblnOK = True
mstrSelTemplate = TxtResult.Text
Unload Me
End Sub
'被其它窗体调用
'第二个参数指明显示哪个字段
Public Function ShowTemplate(ByVal strSQL As String, ByVal intField As Integer) As String
On Error GoTo ErrMsg
Dim Status
Dim i As Integer
' strSQL = "select JYSM from Model_JY" _
' & " where XXID='" & strXXID & "'"
Status = GetRows(strSQL)
If ErrTrue(Status) Then
If Status(0) <> NoRecord Then
ErrMsg Status
End If
Else
For i = 1 To rs.RecordCount
'因为不需要Key值,所以可以随便赋值
lvwTemplates.ListItems.Add i, "W" & i, rs(intField)
rs.MoveNext
Next
Set lvwTemplates.SelectedItem = lvwTemplates.ListItems(1)
CloseRS
End If
Me.Show vbModal
If mblnOK = True Then
ShowTemplate = mstrSelTemplate
End If
Exit Function
ErrMsg:
End Function
Private Sub lvwTemplates_Click()
If Not (lvwTemplates.SelectedItem Is Nothing) Then
TxtResult.Text = TxtResult.Text & lvwTemplates.SelectedItem.Text
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -