Treeview in Vb6

hi
  firstletter = mid(txtfields.text),1,1)
  tvtreeview.nodes(firstletter).children

but i am getting an error. What I need to know is how do I use a varibale and get the number of the children depending on what the first letter of the text box is.
  tvtreeview.nodes("A".children works fine. but I need to use my firstletter varible.
thanks very much for time and assistance
Urgent
CBBNet AdminAsked:
Who is Participating?
 
CBBConnect With a Mentor Net AdminAuthor Commented:
hi angelll and benny

thanks both were correct and my was correct too the problem was what angell told me
that got me thinking. My tree had only capitals letter and my textbox was giving lower cases.
So I had to ucase(firstletter) then it worked

thanks so much for all your help. I will split it since I appreciate all your time and assistance
0
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
what about this:

firstletter = left(txtfields.text,1)
tvtreeview.nodes(firstletter).children

Open in new window

apart from that, if you still get an error, it's because there is no such treeview node with that "letter" as key

0
 
benny_caConnect With a Mentor Commented:
just try

  tvtreeview.nodes(cstr(mid(txtfields.text),1,1))).children
0
 
CBBNet AdminAuthor Commented:
experts exchange is a wonderful site
0
 
CBBNet AdminAuthor Commented:
They gave me an idea that I realize that was not using capitals letters.

thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.