?? kehumanage.frm
字號:
VERSION 5.00
Object = "{CFA7AFF4-3242-4269-9172-7389D695AE01}#1.0#0"; "StoneXP.ocx"
Object = "{DAAC6951-59A4-4C08-9D6E-FE3919B64861}#1.0#0"; "FlexCell.ocx"
Begin VB.Form kehumanage
BorderStyle = 0 'None
Caption = "客戶管理"
ClientHeight = 4215
ClientLeft = 0
ClientTop = 0
ClientWidth = 8205
Icon = "kehumanage.frx":0000
LinkTopic = "xiaoqu"
MaxButton = 0 'False
ScaleHeight = 4215
ScaleWidth = 8205
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin StoneXP.XPButton XPButton4
Height = 375
Left = 7080
TabIndex = 5
Top = 2640
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "修 改"
MouseIcon = "kehumanage.frx":000C
MousePointer = 99
End
Begin FlexCell.Grid Grid1
Height = 4215
Left = 0
TabIndex = 3
Top = 0
Width = 6975
_ExtentX = 12303
_ExtentY = 7435
Appearance = 0
Cols = 5
ExtendLastCol = -1 'True
Rows = 30
ScrollBars = 2
End
Begin StoneXP.XPButton XPButton1
Height = 375
Left = 7080
TabIndex = 1
Top = 1680
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "增 加"
MousePointer = 99
End
Begin StoneXP.XPButton XPButton2
Height = 375
Left = 7080
TabIndex = 2
Top = 2160
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "保 存"
MousePointer = 99
End
Begin StoneXP.XPButton XPButton5
Height = 375
Left = 7080
TabIndex = 0
Top = 3600
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "退 出"
MousePointer = 99
End
Begin StoneXP.XPButton XPButton3
Height = 375
Left = 7080
TabIndex = 4
Top = 3120
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "刪 除"
MousePointer = 99
End
Begin VB.Menu cz
Caption = "操作"
Visible = 0 'False
Begin VB.Menu renovate
Caption = "刷新"
End
End
End
Attribute VB_Name = "kehumanage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fjsave As Boolean
Dim fjedit As Boolean
Dim fjdel As Boolean
Dim i As Integer
Private Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer
Dim gcolor1, gcolor2 As String
Dim m, n As Integer
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '進行注冊
With Grid1
.AllowUserResizing = True
.DisplayFocusRect = False
'.ExtenfjastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.DefaultFont.Size = 8
.BackColorFixed = RGB(128, 217, 193) 'RGB(90, 158, 214)
.BackColorFixedSel = RGB(128, 217, 193) 'RGB(110, 180, 230)
.BackColorBkg = RGB(128, 217, 193) 'RGB(90, 158, 214)
.BackColorScrollBar = RGB(128, 217, 193)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(148, 190, 231)
.Column(0).Width = 0
.Column(1).Width = 100
.Column(2).Width = 100
End With
Me.BackColor = RGB(128, 217, 193)
yxtable = "客戶"
Call callmain
End Sub
Private Sub callmain()
fjsave = False
fjedit = True
fjdel = True
Set yx3 = cnn.Execute("select * from " & yxtable)
Grid1.Rows = 1 '清除所有記錄
i = 5
Grid1.Cols = i + 1 '必須+1,因為實際上為4行,但第一行是隱藏的
For i = 0 To i - 1 '顯示數(shù)據(jù)的字段名
Grid1.Cell(0, i + 1).Text = yx3.Fields(i).Name '讀取表中的各字段名
Next
n = i
i = 1
Do While Not yx3.EOF
Grid1.Rows = Grid1.Rows + 1
For j = 1 To n '設定讀取列
If yx3.Fields(j - 1) = Null Then '空值的處理
Grid1.Cell(i, j).Text = ""
Else
Grid1.Cell(i, j).Text = yx3.Fields(j - 1)
If Mid(Grid1.Cell(i, j).Text, 1, 1) = "." Then
Grid1.Cell(i, j).Text = "0" & Grid1.Cell(i, j).Text
End If
End If
Next
i = i + 1
yx3.MoveNext '讀取下一記錄
Loop
Grid1.Column(1).Locked = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call XPButton5_Click
End Sub
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu cz
End If
End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long)
hang = Row
End Sub
Private Sub Grid1_Validate(Cancel As Boolean) '設定TAB鍵切換
Dim nActiveRow As Long, nActiveCol As Long
Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row
nActiveCol = Grid1.ActiveCell.Col
If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected
End If
Cancel = True
End If
End Sub
Private Sub renovate_Click()
Call callmain
End Sub
Private Sub XPButton1_Click()
fjsave = True
Set yx3 = cnn.Execute("select * from " & yxtable)
Grid1.Rows = 1 '清除所有記錄
Grid1.Rows = 21 '默認為2行
For i = 0 To 1 '顯示數(shù)據(jù)的字段名
Grid1.Cell(0, i + 1).Text = yx3.Fields(i).Name '讀取表中的各字段名
Next
Grid1.Column(1).Locked = False
For i = 1 To Grid1.Rows - 1
Grid1.Cell(i, 3).Text = "0"
Grid1.Cell(i, 4).Text = "0.00"
Grid1.Cell(i, 5).Text = "0.00"
Next
Grid1.Cell(1, 1).SetFocus
XPButton2.Default = True
End Sub
Private Sub XPButton2_Click()
If fjsave = False Then
MsgBox "不支持保存操作!", vbInformation, "當前不支持"
Exit Sub
End If
For i = 1 To Grid1.Rows - 1
For j = i + 1 To Grid1.Rows - 1
If Grid1.Cell(i, 1).Text <> "" Then
If Grid1.Cell(i, 2).Text = "" Then
MsgBox "第" & i & "行的數(shù)據(jù)請?zhí)钔暾?", vbInformation, "錯誤提示"
Grid1.Cell(i, 2).SetFocus
Exit Sub
End If
End If
Next
Next
For i = 1 To Grid1.Rows - 1
If Grid1.Cell(i, 1).Text <> "" Then
Set yx2 = cnn.Execute("select * from 客戶 where 客戶名稱='" & Grid1.Cell(i, 1).Text & "'")
If yx2.EOF = True Then
Dim vbyn As String
Set yx2 = cnn.Execute("insert into 客戶 values('" & Grid1.Cell(i, 1).Text & "','" & Grid1.Cell(i, 2).Text & "'," & Grid1.Cell(i, 3).Text & "," & Grid1.Cell(i, 4).Text & "," & Grid1.Cell(i, 5).Text & ")")
End If
End If
Next
MsgBox "資料已保存!", vbInformation, "完成"
Call callmain
End Sub
Private Sub XPButton3_Click()
If fjdel = False Then
MsgBox "當前刪除操作不被允許!", vbInformation, "非使用對象"
Exit Sub
End If
If hang = 0 Then
Exit Sub
End If
If Grid1.Cell(hang, 1).Text = "" Then
Exit Sub
End If
Set yx3 = cnn.Execute("delete from " & yxtable & " where 客戶名稱='" & Grid1.Cell(hang, 1).Text & "'")
MsgBox "目標己刪除,請刷新數(shù)據(jù)!", vbInformation, "刪除成功"
Call callmain
End Sub
Private Sub XPButton4_Click()
If fjedit = False Then
MsgBox "當前不允許修改操作!", vbInformation, "非使用對象"
Exit Sub
End If
If hang = 0 Then
Exit Sub
End If
If Grid1.Cell(hang, 1).Text = "" Then
Exit Sub
End If
Set yx3 = cnn.Execute("update 客戶 set 聯(lián)系方式='" & Grid1.Cell(hang, 2).Text & "',信用度=" & Grid1.Cell(hang, 3).Text & ",已付金額=" & Grid1.Cell(hang, 4).Text & ",欠費金額=" & Grid1.Cell(hang, 5).Text & " where 客戶名稱='" & Grid1.Cell(hang, 1).Text & "'")
MsgBox "目標行已修改,建議刷新數(shù)據(jù)!", vbInformation, "修改完成"
End Sub
Private Sub XPButton5_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -