Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview Add Node Error (version 6)

Status
Not open for further replies.

Beaner5434

Programmer
Jul 18, 2001
12
US
I'm creating a treeview control with VB6. If I use version 5 of the treeview control, the following codeline works just fine...

Set nodX = frmPatTree.trePatRecs.Nodes.Add(, , "Alpha", "Patient Names (" & PatCount & " patients)")

However, if I use that same line with version 6 of the treeview control, I get an Error #13 -- Type mismatch.

Any idea why?
 
Try to cteate a String variable and give it the value "Patient Names (" & PatCount & " patients)"

and

Set nodX = frmPatTree.trePatRecs.Nodes.Add(, , &quot;Alpha&quot;, <<Strin Variable>>)

If dosen't work (I know it's illogical) try to change the treeview control on You form. The syntax it's correct.

Tibi
 
I thought of that, and I still get the error. I even tried the examples they give in the help file, with the same results. The syntax is right on the mark, so I don't understand why I am getting a type mismatch error. Very weird...
 
Not sure but is PATCOUNT a variant? or numeric?

If numeric you can try converting to string:

Set nodX = frmPatTree.trePatRecs.Nodes.Add(, , &quot;Alpha&quot;, &quot;Patient Names (&quot; & [red]STR$([/red]PatCount[red])[/red] & &quot; patients)&quot;)

I know this is silly, since it works in 5, but this is the best I can offer on TYPE MISMATCHes (and it is also based on 1127's notes about STRING VARIABLEs...it's the only non-string in the lot).

Hope it helps some. --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
Change the control on You form (put on a new one)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top