?? customerdetails.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmcustdetails
Caption = "Form1"
ClientHeight = 7950
ClientLeft = 165
ClientTop = 270
ClientWidth = 9930
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7950
ScaleWidth = 9930
Begin VB.CommandButton CmdClose
Caption = "Close"
Height = 495
Left = 2760
TabIndex = 6
Top = 7320
Width = 1695
End
Begin VB.PictureBox Picture2
Height = 5295
Left = 2520
ScaleHeight = 5235
ScaleWidth = 6195
TabIndex = 3
Top = 1800
Width = 6255
Begin MSComctlLib.TreeView TreeView1
Height = 30
Left = 4920
TabIndex = 7
Top = 2280
Width = 135
_ExtentX = 238
_ExtentY = 53
_Version = 393217
Style = 7
Appearance = 1
End
Begin MSComctlLib.ListView lvwCustDetails
Height = 5295
Left = 0
TabIndex = 4
Top = 0
Width = 6255
_ExtentX = 11033
_ExtentY = 9340
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
End
Begin VB.PictureBox Picture1
Height = 5295
Left = 120
ScaleHeight = 5235
ScaleWidth = 2235
TabIndex = 2
Top = 1800
Width = 2295
Begin MSComctlLib.TreeView tvwcountry
Height = 5295
Left = 0
TabIndex = 5
Top = 0
Width = 2295
_ExtentX = 4048
_ExtentY = 9340
_Version = 393217
Style = 7
Appearance = 1
End
End
Begin VB.Label LblClickcountryname
Caption = "Click on the country names to view the customers deatils"
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 1
Top = 1200
Width = 9375
End
Begin VB.Label LblCwcd
Caption = "Custory Wise Customer Details"
BeginProperty Font
Name = "宋體"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 0
Top = 480
Width = 5535
End
End
Attribute VB_Name = "frmcustdetails"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rscountry As ADODB.Recordset
Dim rscustdet As ADODB.Recordset
Private Sub CmdClose_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim nodecountry As Node
'invoking the sub procedure from the standard module
Getconnected
'populating the tree view control
Set rscountry = New ADODB.Recordset
rscountry.Open "select distinct country from customers ", cn, adOpenDynamic, adLockBatchOptimistic
Set nodecountry = tvwcountry.Nodes.Add(, , "r", "Country")
inti = 0
rscountry.MoveFirst
Do While Not rscountry.EOF
Set nodecountry = tvwcountry.Nodes.Add("r", tvwChild, rscountry!country, rscountry!country)
inti = inti + 1
rscountry.MoveNext
Loop
MakeColumns
End Sub
Private Sub tvwcountry_NodeClick(ByVal Node As MSComctlLib.Node)
Dim str1 As String
Dim mitem As ListItem
'populating the list view control
Set rscustdet = New ADODB.Recordset
str1 = "select * from customers where country='" & Node.Text & " '"
rscustdet.Open str1, cn
lvwCustDetails.ListItems .Clear
Do Until rscustdet.EOF
Set mitem = lvwCustDetails.ListItems.Add()
mitem.Text = rscustdet!cust_id
mitem.SubItems(1) = rscustdet!Cust_name
mitem.SubItems(2) = rscustdet!Address
mitem.SubItems(3) = rscustdet!Gender
mitem.SubItems(4) = rscustdet!country
mitem.SubItems(5) = rscustdet!Phone
rscustdet.MoveNext
Loop
End Sub
Private Sub MakeColumns()
'Adding column headers to the List View
lvwCustDetails.ColumnHeaders.Add , , "Customer ID"
lvwCustDetails.ColumnHeaders.Add , , "Customer Name"
lvwCustDetails.ColumnHeaders.Add , , "Address"
lvwCustDetails.ColumnHeaders.Add , , "Gender"
lvwCustDetails.ColumnHeaders.Add , , "Country"
lvwCustDetails.ColumnHeaders.Add , , "Phone No."
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -