Results 1 to 6 of 6

Thread: [RESOLVED] treeview with recordset

  1. #1

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Resolved [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)
    Attached Images Attached Images  
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  2. #2

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Re: treeview with recordset

    Iam still waiting guys, please any body help...................
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  3. #3
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    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

    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
    Last edited by mikee_phil; Feb 16th, 2006 at 06:03 AM.

  4. #4
    Addicted Member LeonX's Avatar
    Join Date
    Dec 2004
    Location
    Jakarta, Indonesia
    Posts
    172

    Re: treeview with recordset

    Hi shirishdawane,
    Try this, might be help.
    Attached Files Attached Files
    Regards,
    Ferry

  5. #5

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    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

    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.
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  6. #6

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Re: treeview with recordset

    Wow ! thats fantastic. this is a perfect example which i was hoping. Thanx
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width