📄 frmcushelplist.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmCusHelpList
BorderStyle = 1 'Fixed Single
Caption = "Customer Help"
ClientHeight = 4800
ClientLeft = 30
ClientTop = 330
ClientWidth = 5715
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmCusHelpList.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4800
ScaleWidth = 5715
StartUpPosition = 3 'Windows Default
Begin MSComctlLib.ListView lvwShower
Height = 3495
Left = 120
TabIndex = 7
Top = 1155
Width = 5490
_ExtentX = 9684
_ExtentY = 6165
View = 3
Arrange = 1
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 0
End
Begin VB.Frame Frame1
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 990
Left = 120
TabIndex = 2
Top = 72
Width = 3708
Begin VB.TextBox txtCode
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 264
Left = 672
TabIndex = 4
Top = 168
Width = 2868
End
Begin VB.TextBox txtName
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 264
Left = 672
TabIndex = 3
Top = 585
Width = 2868
End
Begin VB.Label lblCode
BackStyle = 0 'Transparent
Caption = "Code"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 204
Left = 144
TabIndex = 6
Top = 192
Width = 540
End
Begin VB.Label lblName
BackStyle = 0 'Transparent
Caption = "Desc"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 150
TabIndex = 5
Top = 600
Width = 540
End
End
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 4440
TabIndex = 1
Top = 720
Width = 1020
End
Begin VB.CommandButton cmdOk
Caption = "OK"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 4440
TabIndex = 0
Top = 180
Width = 1020
End
End
Attribute VB_Name = "frmCusHelpList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public sCusCode As Long
Private Sub cmdCancel_Click()
Me.Tag = vbCancel
Me.Hide
End Sub
Private Sub cmdOK_Click()
Me.Tag = vbOK
Me.Hide
End Sub
Private Sub Form_Activate()
lvwShower.SetFocus
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then cmdCancel = True
End Sub
Private Sub Form_Load()
Me.Tag = vbCancel
InitListView
If Trim(sCusCode) <> "" Then
Call ShowItem(sCusCode)
Else
sCusCode = "0"
Call ShowItem(sCusCode)
End If
End Sub
Private Sub InitListView()
With lvwShower
.FullRowSelect = True
.LabelEdit = lvwAutomatic
.ListItems.Clear
.ColumnHeaders.Add , , "Customer Code", 1800
.ColumnHeaders.Add , , "Customer Desciption", .Width - 1600
End With
End Sub
Public Function ShowItem(ByVal Cuscode As Long)
Dim sSQL As String
Dim rstItem As ADODB.Recordset
Dim ItemX As MSComctlLib.ListItem
sSQL = " select * from appcus"
sSQL = sSQL & " where cuscode >= " & Cuscode
sSQL = sSQL & " and astatus ='Y'"
sSQL = sSQL & " order by cuscode"
Set rstItem = Acs_cnt.Execute(sSQL)
With rstItem
txtCode = "": txtCode.Tag = -1
txtName = ""
lvwShower.ListItems.Clear
Do While Not .EOF
Set ItemX = lvwShower.ListItems.Add(, , .Fields("cuscode"))
'ItemX.Text = .Fields("cuscode")
ItemX.SubItems(1) = .Fields("cusdesc")
ItemX.Tag = .Fields("cuscode")
.MoveNext
Loop
End With
With lvwShower
If .ListItems.Count > 0 Then
.ListItems(1).Selected = True
FillTxt
End If
End With
If Not rstItem Is Nothing Then Set rstItem = Nothing
End Function
Private Sub FillTxt()
Dim ItemX As MSComctlLib.ListItem
Set ItemX = lvwShower.SelectedItem
If ItemX Is Nothing Then Exit Sub
txtCode = ItemX.Tag
txtCode.Tag = ItemX.Tag
txtName = ItemX.SubItems(1)
End Sub
Private Sub Form_Resize()
If Trim(sCusCode) <> "" Then
Call ShowItem(sCusCode)
Else
sCusCode = "0"
Call ShowItem(sCusCode)
End If
End Sub
Private Sub lvwShower_Click()
FillTxt
End Sub
Private Sub lvwShower_DblClick()
FillTxt
cmdOk = True
End Sub
Private Sub lvwShower_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
FillTxt
cmdOk = True
End If
End Sub
Private Sub txtCode_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
sCusCode = txtCode
Call ShowItem(sCusCode)
lvwShower.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -