|
-
May 22nd, 2002, 12:20 AM
#1
Thread Starter
Lively Member
TreeView - What am I doing wrong?
I have the following code to add the root level to a treeview control:
Code:
Set nodX = TreeView1.Nodes.Add(, , "lvl1" & m_rsLevel1!strDesc, m_rsLevel1!strDesc)
I've done this a billion times in the past, but this keeps giving me a "Type Mismatch" error. The field "strDesc" is a string, so the key should be ok. Can anyone kick me the butt and face me the right way?? Thanks.
-
May 22nd, 2002, 01:23 AM
#2
MSDN..
[code]
TV1.Add(relative, relationship, key, text, image, selectedimage)
tvwFirst 0 First. The Node is placed before all other nodes at the same level of the node named in relative.
tvwLast 1 Last. The Node is placed after all other nodes at the same level of the node named in relative. Any Node added subsequently may be placed after one added as Last.
tvwNext 2 (Default) Next. The Node is placed after the node named in relative.
tvwPrevious 3 Previous. The Node is placed before the node named in relative.
tvwChild 4 Child. The Node becomes a child node of the node named in relative.
[code/]
-
May 22nd, 2002, 01:57 AM
#3
Thread Starter
Lively Member
Thanks, khalik
I can make the TreeView work if I do not try to set the node "nodX". However, by doing that, I lose out on being able to use the "forecolor" property. So, I have to perform the assignment as:
"set nodX = ..."
-
May 22nd, 2002, 03:00 AM
#4
Originally posted by Jeff Carlin
Thanks, khalik
I can make the TreeView work if I do not try to set the node "nodX". However, by doing that, I lose out on being able to use the "forecolor" property. So, I have to perform the assignment as:
"set nodX = ..."
[code]
Dim nodX As Node ' Declare Node variable.
' First node with 'Root' as text.
Set nodX = TreeView1.Nodes.Add(, , "r", "Root")
' This next node is a child of Node 1 ("Root").
Set nodX = TreeView1.Nodes.Add("r", tvwChild, "child1", "Child")
[code/]
node does not have the use the "forecolor" property
what are u looking for.
-
May 22nd, 2002, 04:50 AM
#5
Fanatic Member
Jeff,
I tried your code and it worked ok for me. All I can think is that the field m_rsLevel1!strDesc contains something dodgy. What are the contents of this when you get the error? What is the datatype of the field?
I managed to recreate the error message by passing Null instead of m_rsLevel1!strDesc. Could be that the recordset is empty.
Martin J Wallace (Slaine)
-
May 22nd, 2002, 07:45 AM
#6
Thread Starter
Lively Member
Slaine:
That'w what's so wacky! The recordset is full and I can see a value when the error hits. Without doing the assignment (Set xNod = ...), the sucker works. I'm starting to think that it's something in the Dim statement: Dim xNod As Node
(30 seconds later...)
Ah...just found it. Typical dumba$$ error. I had referenced "comctl32" instead of "mscomctl". Boom. Problem solved. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|