0% found this document useful (0 votes)
35 views1 page

' - Menampilkan Menu Induk: STRSQL "Select Id, Menu - Name, Menu - Caption From Menu - Induk Order by Id"

This code is adding menu items from database tables to a tree view control. It opens a recordset containing parent menu items, then loops through adding each as a node. It then opens a second recordset of child menu items, filtering by the parent ID, and loops through adding each as a child node of the parent. Finally it sets all nodes to be expanded and closes the recordsets.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

' - Menampilkan Menu Induk: STRSQL "Select Id, Menu - Name, Menu - Caption From Menu - Induk Order by Id"

This code is adding menu items from database tables to a tree view control. It opens a recordset containing parent menu items, then loops through adding each as a node. It then opens a second recordset of child menu items, filtering by the parent ID, and loops through adding each as a child node of the parent. Finally it sets all nodes to be expanded and closes the recordsets.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Private Sub addMenu() Dim rsMenuInduk As ADODB.Recordset Dim rsMenuAnak As ADODB.

Recordset Dim root As Node Dim i As Long Dim As Long Dim ro!"ount(#) As Long mnu$ree.Nodes."%ear &it' mnu$ree.Nodes '-> menampilkan menu induk strS(% ) *S+L+"$ id, menu-name, menu-ca.tion /ROM menu-induk ORD+R B0 id* Set rsMenuInduk ) o.enRecordset(strS(%) I1 Not rsMenuInduk.+O/ $'en ro!"ount(2) ) getRecord"ount(rsMenuInduk) /or i ) # $o ro!"ount(2) Set root ) .Add(, , rsMenuInduk(*menu-name*).3a%ue, rsMenuInduk(*menu-ca.tion*).3a%ue) root.Bo%d ) $rue '-> menampilkan menu anak strS(% ) *S+L+"$ menu-name, menu-ca.tion /ROM menu-anak &4+R+ menu-induk-id ) * 5 rsMenuInduk(*id*).3a%ue 5 * ORD+R B0 id* Set rsMenuAnak ) o.enRecordset(strS(%) I1 Not rsMenuAnak.+O/ $'en ro!"ount(#) ) getRecord"ount(rsMenuAnak) /or ) # $o ro!"ount(#) .Add root, tv!"'i%d, rsMenuAnak(*menu-name*).3a%ue, rsMenuAnak(*menu-ca.tion*).3a%ue rsMenuAnak.MoveNe t Ne t +nd I1 "a%% c%oseRecordset(rsMenuAnak) rsMenuInduk.MoveNe t Ne t i +nd I1 "a%% c%oseRecordset(rsMenuInduk) +nd &it' /or i ) # $o mnu$ree.Nodes."ount mnu$ree.Nodes(i).+ .anded ) $rue Ne t +nd Sub

You might also like