📄 frmkhinfo.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmkhinfo
Caption = "客户管理"
ClientHeight = 5970
ClientLeft = 60
ClientTop = 345
ClientWidth = 7785
LinkTopic = "Form1"
ScaleHeight = 5970
ScaleWidth = 7785
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame6
Height = 855
Left = 120
TabIndex = 1
Top = 4920
Width = 7575
Begin VB.CommandButton cmdClose
Caption = "返回"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5640
TabIndex = 6
Top = 360
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 4
Top = 360
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "修改"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2400
TabIndex = 3
Top = 360
Width = 1095
End
Begin VB.CommandButton Command5
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 2
Top = 360
Width = 1095
End
End
Begin VB.Frame Frame7
Caption = "客户信息浏览"
Height = 4455
Left = 120
TabIndex = 0
Top = 360
Width = 7575
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 4095
Left = 120
TabIndex = 5
Top = 240
Width = 7335
_ExtentX = 12938
_ExtentY = 7223
_Version = 393216
AllowUserResizing= 1
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "客户信息管理"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 2880
TabIndex = 7
Top = 120
Width = 2295
End
End
Attribute VB_Name = "frmkhinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Download by http://www.codefans.net
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Command1_Click()
Load frmkh
frmkh.Show 1
End Sub
Private Sub Command4_Click()
Dim intCount As Integer
Dim txtsql As String
If msgList.Rows > 1 Then
'gintDHmode = 2
intCount = msgList.Row
If intCount > 0 Then
txtsql = "select * from 客户表 where 用户编号 ='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
khEdit = 1
Load frmkh
frmkh.showdata (txtsql)
'frmkh.showdata (txtsql)
frmkh.Show 1, frmkhinfo
Else
MsgBox "警告", vbOKOnly + vbExclamation, "请首先选择需要修改的纪录!"
End If
End If
End Sub
Private Sub Form_Load()
Call ShowTitle
Call showdata
End Sub
Private Sub Command5_Click() '删除客户记录
Dim txtsql As String
Dim intCount As Integer
Dim MsgText As String
If msgList.Rows > 1 Then
If MsgBox("确认要删除客户编号为" & Trim(msgList.TextMatrix(msgList.Row, 1)) & "的记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
intCount = msgList.Row&
txtsql = "delete from 客户表 where 用户编号='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
ExeSQL (txtsql)
MsgBox "记录删除成功!", vbInformation, "系统提示"
Call showdata
msgList.Refresh
End If
End If
End Sub
Public Sub ShowTitle()
Dim i As Integer
With msgList
.Cols = 7
.TextMatrix(0, 1) = "客户编号"
.TextMatrix(0, 2) = "姓名"
.TextMatrix(0, 3) = "电话"
.TextMatrix(0, 4) = "手机"
.TextMatrix(0, 5) = "联系地址"
.TextMatrix(0, 6) = "其它信息"
'固定表头
.FixedRows = 1
.TextStyle = flexTextFlat
'设置各列的对齐方式
For i = 0 To 5
.ColAlignment(i) = 0
Next i
'表头项居中
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
'设置单元大小
.WordWrap = True
.ColWidth(0) = 500
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 2000
.ColWidth(4) = 2000
.ColWidth(5) = 3500
.ColWidth(6) = 5000
.Row = 1
End With
End Sub
Public Sub showdata()
Dim j As Integer
Dim i As Integer
Dim sqlshow As String
Dim mrc As ADODB.Recordset
sqlshow = "select * from 客户表"
Set mrc = ExeSQL(sqlshow)
If mrc.EOF Then
frmkh.Show 1, frmkhinfo
mrc.Close
Set mrc = Nothing
Exit Sub
End If
With msgList
.Rows = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
If Not IsNull(Trim(mrc.Fields(i - 1))) Then
Select Case mrc.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
End Select
End If
Next i
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmkhinfo = Nothing
End Sub
Private Sub msgList_Click()
'msgList.BackColorSel = vbBlue
End Sub
Private Sub msgList_EnterCell()
msgList.SelectionMode = flexSelectionByRow
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -