Hi everyone again,

How to check SelectedNode's child? There is ->SelectedNode->Parent, but how
to check/control a child?

Thanks in advance,
gmb

Re: SelectedNode by Herfried

Herfried
Sat Apr 21 06:09:30 CDT 2007

"gmb" <diehard_gmb@wp.pl> schrieb:
> How to check SelectedNode's child? There is ->SelectedNode->Parent, but
> how to check/control a child?

'Me.TreeView1.SelectedNode.Nodes(<index>)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Re: SelectedNode by gmb

gmb
Sat Apr 21 07:30:13 CDT 2007

Ty for Your reply,

I would like to control a node only if it has a child node.

if (TreeView1->SelectedNode->Nodes[0])
{
//mycode
}

Given code works (enters parenthesis) only if a node has child nodes, but if
there is no TreeView1->SelectedNode->Nodes[0] it returns an exception of
type System.ArgumentOutOfRangeException.
Could You tell me what should be taken into considerations? I really don't
want to handle this exception.

gmb


"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:eF%23%23JWAhHHA.960@TK2MSFTNGP03.phx.gbl...
> "gmb" <diehard_gmb@wp.pl> schrieb:
>> How to check SelectedNode's child? There is ->SelectedNode->Parent, but
>> how to check/control a child?
>
> 'Me.TreeView1.SelectedNode.Nodes(<index>)'.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>


Re: SelectedNode by Herfried

Herfried
Sat Apr 21 13:42:41 CDT 2007

"gmb" <diehard_gmb@wp.pl> schrieb:
> I would like to control a node only if it has a child node.
>
> if (TreeView1->SelectedNode->Nodes[0])
> {
> //mycode
> }
>
> Given code works (enters parenthesis) only if a node has child nodes, but
> if there is no TreeView1->SelectedNode->Nodes[0] it returns an exception
> of type System.ArgumentOutOfRangeException.

\\\
if (TreeView1->SelectedNode->Nodes->Count > 0)
...;
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Re: SelectedNode by gmb

gmb
Sun Apr 22 09:54:54 CDT 2007

Ty very, very much

gmb

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%23bXILSEhHHA.4552@TK2MSFTNGP04.phx.gbl...
> "gmb" <diehard_gmb@wp.pl> schrieb:
>> I would like to control a node only if it has a child node.
>>
>> if (TreeView1->SelectedNode->Nodes[0])
>> {
>> //mycode
>> }
>>
>> Given code works (enters parenthesis) only if a node has child nodes, but
>> if there is no TreeView1->SelectedNode->Nodes[0] it returns an exception
>> of type System.ArgumentOutOfRangeException.
>
> \\\
> if (TreeView1->SelectedNode->Nodes->Count > 0)
> ...;
> ///
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>