Re: Treeview help



"MikeD" <nobody@xxxxxxxxxxx> wrote in message
news:edWVYgcCGHA.2336@xxxxxxxxxxxxxxxxxxxx
> "Bob Butler" <tiredofit@xxxxxxxxxx> wrote in message
> news:eFOAA7bCGHA.2036@xxxxxxxxxxxxxxxxxxxxxxx
>> "MikeD" <nobody@xxxxxxxxxxx> wrote in message
>> news:OsqnrfbCGHA.3920@xxxxxxxxxxxxxxxxxxxx
>>> <Fern G> wrote in message
>>> news:ubx6w6WCGHA.916@xxxxxxxxxxxxxxxxxxxxxxx Set mynod =
>>> TreeView1.Nodes.Add(mynod.Key, tvwChild, s1(i), s1(i))
>>
>> As an aside... the first argument is a reference to the parent. You
>> can pass a key and the control will do a lookup to find the mode but
>> since you already have the reference it's simpler just to use it:
>> Set mynod = TreeView1.Nodes.Add(mynod, tvwChild, s1(i), s1(i))
>
> I didn't know you could pass a reference to a Node object for the
> first parameter. I thought it had to be an index or a key (IOW, an
> integer or a string). I wonder.....would a reference to a Node object
> get passed....or would the default property of the Node object get
> passed (which I believe is the Text property)? In any case, I don't
> think passing a Node object is a good idea. If nothing else, there's
> uncertainty (IMO) of what's actually getting passed. Is it a
> reference to a Node or is it the default property of the Node object?

The parameter is defined 'as variant' so what gets passed is the node
reference. I can't see the control determining that it has the reference
and so getting the key to look up the reference again but I guess stranger
things have happened. Unless it can be demonstrated otherwise I'd hold that
passing the reference is the better option.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

.



Relevant Pages

  • RE: How to get reference to instance of a generic object type
    ... In my situation I am sometimes passing in a label, or textbox control. ... Passing Value Types by Reference ... // Changes to x will affect the original value of myInt. ...
    (microsoft.public.dotnet.framework)
  • RE: How to get reference to instance of a generic object type
    ... In my situation I am sometimes passing in a label, or textbox control. ... Passing Value Types by Reference ... // Changes to x will affect the original value of myInt. ...
    (microsoft.public.dotnet.framework)
  • Re: Populating a drop downlist
    ... >> the control and having this method populate it as opposed to passing ... Or should I designate that the parameter as a reference value? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: get control recursion
    ... Wouldn't you want to pass "passedCtrl" by reference? ... value causes every call to the method to make a copy of the control. ... surprised if passing an object-type parameter by value ends up passing ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Treeview help
    ... > Mike, thank you, ... In VB6's Treeview, there's only one Nodes collection, a reference to ... which is obtained from the Nodes property of the Treeview control itself. ... LastSibling, Next, Previous, Parent, and Root properties of a Node object. ...
    (microsoft.public.vb.general.discussion)