Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Select a node after its created

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Rogers - 10 Mar 2008 00:48 GMT
How do you keep the selection on a newly created treenode?

After I hit enter, the selection always go back to the first root
node.

TIA
Morten Wennevik [C# MVP] - 10 Mar 2008 07:24 GMT
Hi John,

How do you create the node?  Is this a window or web application?

Signature

Happy Coding!
Morten Wennevik [C# MVP]

> How do you keep the selection on a newly created treenode?
>
> After I hit enter, the selection always go back to the first root
> node.
>
> TIA
John - 10 Mar 2008 13:17 GMT
Hi,

I am creating it from a popup menu.

       private void newCategoryToolStripMenuItem_Click(object sender,
EventArgs e)
       {
           TreeNode ParentNode = treeView1.Nodes.Add("New Category");
       }

Thanks

> Hi John,
>
[quoted text clipped - 6 lines]
>>
>> TIA
Marc Gravell - 10 Mar 2008 13:39 GMT
All you need is:
treeView1.SelectedNode = newNode;

Marc
John - 10 Mar 2008 15:31 GMT
Thanks Marc,

I had tried the following but I couldn't get it to work.
treeView1.SelectedNode = e.Node;

I will see what messing it up.

Thanks again

> All you need is:
> treeView1.SelectedNode = newNode;
>
> Marc
Marc Gravell - 10 Mar 2008 16:09 GMT
Are you rebuilding the node tree at all?
John - 10 Mar 2008 16:24 GMT
No, no rebuilding.  I am not too worried about it right now,
I was just wondering if I was on the right track.  I will have
to put in on the todo list I guess :)

Appreciate the help.

John

> Are you rebuilding the node tree at all?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.