📄 form6.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form Form6
BorderStyle = 3 'Fixed Dialog
Caption = "双击选择一个商家"
ClientHeight = 7545
ClientLeft = 45
ClientTop = 375
ClientWidth = 7470
KeyPreview = -1 'True
LinkTopic = "Form6"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 7545
ScaleWidth = 7470
ShowInTaskbar = 0 'False
Begin CSCommand.Command Command1
Height = 390
Left = 5400
TabIndex = 3
Top = 7065
Width = 1950
_ExtentX = 3440
_ExtentY = 688
IconAlign = 0
Icon = "Form6.frx":0000
Caption = "添加新商家 &A"
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.TextBox Text1
Height = 330
Left = 2340
TabIndex = 2
Top = 7095
Width = 2880
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "Form6.frx":001C
Height = 6885
Left = 120
TabIndex = 0
Top = 120
Width = 7275
_ExtentX = 12832
_ExtentY = 12144
_Version = 393216
Cols = 4
RowHeightMin = 300
ScrollTrack = -1 'True
SelectionMode = 1
AllowUserResizing= 1
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "快速检索(按照助记码):"
Height = 180
Left = 180
TabIndex = 1
Top = 7170
Width = 2160
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/12/24
'描 述:商务名片及客户资料管理系统 Ver 1.73
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Option Explicit
Private Sub Command1_Click()
If form1show = True Then
Form1.SetFocus
Else
Load Form1
Form1.Show
Unload Form6
End If
End Sub
Private Sub Form_Load()
HookWheel Me.hwnd '用于支持鼠标滚轮
Me.Top = (Screen.Height - Me.Height) / 4
Me.Left = (Screen.Width - Me.Width) / 2
Me.Icon = MDIForm1.Icon
Me.BackColor = FormBackColor
Me.MSFlexGrid1.BackColorFixed = 16777178
Me.MSFlexGrid1.BackColorBkg = MsFlexGridBackColorBkgValue
form6show = True
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(MdbPath)
Set rs = db.OpenRecordset("select ID,企业名称,企业助记码,法人代表 from com order by id desc")
If rs.RecordCount = 0 Then
'MsgBox "数据库中没有可供选择的商家,程序将要打开添加商家的窗口,请在添加商家之后再回到这里来.", vbInformation, "没有商家供选择"
'Load Form1
'Form1.Show
'Unload Me
Exit Sub
ElseIf rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
End If
Dim i As Integer
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Me.MSFlexGrid1.TextMatrix(0, 0) = "ID"
Me.MSFlexGrid1.TextMatrix(0, 1) = "企业名称"
Me.MSFlexGrid1.TextMatrix(0, 2) = "企业助记码"
Me.MSFlexGrid1.TextMatrix(0, 3) = "法人代表"
Me.MSFlexGrid1.ColAlignment(0) = 4
Me.MSFlexGrid1.ColWidth(0) = 500
Me.MSFlexGrid1.ColWidth(1) = 3000
Me.MSFlexGrid1.ColWidth(2) = 2000
Me.MSFlexGrid1.ColWidth(3) = 1000
Do Until rs.EOF = True
i = i + 1
Me.MSFlexGrid1.TextMatrix(i, 0) = rs!id
Me.MSFlexGrid1.TextMatrix(i, 1) = rs!企业名称
Me.MSFlexGrid1.TextMatrix(i, 2) = rs!企业助记码
Me.MSFlexGrid1.TextMatrix(i, 3) = rs!法人代表
rs.MoveNext
Loop
Me.MSFlexGrid1.Rows = Me.MSFlexGrid1.Rows + 1
Me.MSFlexGrid1.TextMatrix(i + 1, 0) = "0"
Me.MSFlexGrid1.TextMatrix(i + 1, 1) = "(单位不详,或无所属单位)"
End Sub
Private Sub Form_Unload(Cancel As Integer)
AllBaiFangShow = False
Form5.Enabled = True
form6show = False
End Sub
Private Sub MSFlexGrid1_GotFocus()
Set CtlWheel = MSFlexGrid1 '用于设定支持鼠标滚轮
End Sub
Private Sub MSFlexGrid1_LostFocus()
Set CtlWheel = Nothing '用于设定取消鼠标滚轮的支持
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
UnHookWheel Me.hwnd '卸载鼠标滚轮的支持
End Sub
Private Sub MSFlexGrid1_DblClick()
Form5.Text7.Text = Form6.MSFlexGrid1.TextMatrix(Form6.MSFlexGrid1.RowSel, 0)
Form5.Text13.Text = Form6.MSFlexGrid1.TextMatrix(Form6.MSFlexGrid1.RowSel, 1)
Unload Form6
End Sub
Private Sub Text1_GotFocus()
SendKeys "{end}"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.Text = Trim(Text1.Text)
If Text1.Text = "" Then
Text1.SetFocus
Exit Sub
End If
If KeyAscii = 13 Then
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(MdbPath)
Set rs = db.OpenRecordset("select ID,企业名称,企业助记码,法人代表 from com where 企业助记码 like '*" & Text1.Text & "*' order by id desc")
If rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
Else
Me.MSFlexGrid1.Clear
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Exit Sub
End If
Dim i As Integer
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Me.MSFlexGrid1.TextMatrix(0, 0) = "ID"
Me.MSFlexGrid1.TextMatrix(0, 1) = "企业名称"
Me.MSFlexGrid1.TextMatrix(0, 2) = "企业助记码"
Me.MSFlexGrid1.TextMatrix(0, 3) = "法人代表"
For i = 1 To rs.RecordCount
Me.MSFlexGrid1.TextMatrix(i, 0) = rs!id
Me.MSFlexGrid1.TextMatrix(i, 1) = rs!企业名称
Me.MSFlexGrid1.TextMatrix(i, 2) = rs!企业助记码
Me.MSFlexGrid1.TextMatrix(i, 3) = rs!法人代表
rs.MoveNext
Next i
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -