1 Attachment(s)
[RESOLVED] treeview with recordset
Hi all,
1) I want to get a treeview to be generate with following recordset so how can I do this ?
Sorry ! not work with treeview control before in VB 6.0?
Code:
Recordset : SELECT userm FROM usermaster WHERE deleted = No
attached image is displays how treeview should looks.
2) Another que. is that when I click on perticular node of treeview(username) then what shall I write in WHERE condition of recordset which I am using to display records in grid
Code:
e.g. Select password,active from usermaster where username = 'Admin' (treeview node name)
Re: treeview with recordset
Iam still waiting guys, please any body help................... :(
Re: treeview with recordset
look at this
Private Sub Form_Load()
Dim nd As Node, nd2 As Node
Set nd = t.Nodes.Add(, , "Root", "FRRO Navigator") 'parent node
nd.Expanded = True
'select query
Dim n As Integer
n = 0
Do While Not n = Str(rs.RecordCount)
Set nd = t.Nodes.Add("Root", tvwChild, , rs.Fields(0).Value) ' child node assuming field(0) is the users :wave:
n = n + 1
Loop
End Sub
Private Sub t_Click()
If t.SelectedItem.Selected Then MsgBox t.Nodes(t.SelectedItem.Index).Text
'"Select password,active from usermaster where username = '"& t.Nodes(t.SelectedItem.Index).Text &"'" (treeview node name)
End Sub
hope this helps
1 Attachment(s)
Re: treeview with recordset
Hi shirishdawane,
Try this, might be help.
Re: treeview with recordset
Quote:
Originally Posted by mikee_phil
look at this
Private Sub Form_Load()
Dim nd As Node, nd2 As Node
Set nd = t.Nodes.Add(, , "Root", "FRRO Navigator") 'parent node
nd.Expanded = True
'select query
Dim n As Integer
n = 0
Do While Not n = Str(rs.RecordCount)
Set nd = t.Nodes.Add("Root", tvwChild, , rs.Fields(0).Value) ' child node assuming field(0) is the users :wave:
n = n + 1
Loop
End Sub
Private Sub t_Click()
If t.SelectedItem.Selected Then MsgBox t.Nodes(t.SelectedItem.Index).Text
'"Select password,active from usermaster where username = '"& t.Nodes(t.SelectedItem.Index).Text &"'" (treeview node name)
End Sub
hope this helps
Thanx buddy for your reply, let me try by your method & but Please use [vbcode ] your code goes in here [/Highlight] tags when posting code. :thumb:
Re: treeview with recordset
Wow ! ;) thats fantastic. this is a perfect example which i was hoping. Thanx :wave: