[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

treeview control in vb6 - kep value error

Posted on 2004-03-29
4
Medium Priority
?
326 Views
Last Modified: 2008-03-17
I am trying to use treeview control in vb6. Its giving error with the key parameter as invalid key value when I am trying to add nodes at run time.
what type of value does the key parameter takes (String / int) ?
please help
0
Comment
Question by:rk75
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
SRigney earned 75 total points
ID: 10707355
The key must be a string, that is it must at least start with an alpha.  Then it can be alpha or numeric.

Many people (include me) want to use the key to hold an ID to the database.  What I do is append the letter K in front of the actual ID

Dim strKey as String
strKey = "K" & rs.fields("ID")
0
 

Author Comment

by:rk75
ID: 10707477
Thanks!!
I got the solution. I was trying to assign a number as a string as key of a node.
I tried the concatenated alphanumeric value starting with an alpha and it worked!!!

0
 
LVL 15

Expert Comment

by:SRigney
ID: 10707506
don't forget to grade it so the question is closed and I get the points.

Glad I could help.
0
 

Expert Comment

by:tomerps1
ID: 10738898
Dear Friend

it will take parameter of string type. u can c this small code. I hope it will help u.




Private Sub LoadTree()
    Dim intCounter As Integer

    On Error GoTo errHandler
    Call OpenConnection
   
    strQuery = "SELECT * FROM tblSupplierMaster ORDER BY Name"
    Set objRdo = objConn.Execute(strQuery)
   
    While Not objRdo.EOF
        Set XNode = treeviewSupplier.Nodes.Add(, , "Key " & objRdo("SupplierCode"), objRdo("Name"))
        objRdo.MoveNext
    Wend
   
    objRdo.Close
    Call CloseConnection
   
    Exit Sub
   
errHandler:
    MsgBox Err.Description, vbCritical, ERROR_CAPTION
End Sub


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Six Sigma Control Plans
Loops Section Overview

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question