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 / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

treeview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
feudalac! - 08 Jun 2006 14:42 GMT
I have a treeview wist several nodes
each node has its own context menu
for now, every menuitem in theese menues has the same code:
msgbox (treeview1.selectednode.name.tostring,okonly)

the problem is that every i click on the menuitem the message box shows
me name of the node that was selected before rightclick  and thet node
is stil selected.

how do i get node name of the node where right click happened?
FUnky - 08 Jun 2006 15:22 GMT
private void treeView1_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)

{

if (e.Button == MouseButtons.Right)

{

this.treeView1.SelectedNode = this.treeView1.GetNodeAt(e.X ,e.Y );

this.contextMenu1.Show(this.treeView1,new Point(e.X,e.Y));

}

}
feudalac! - 09 Jun 2006 07:00 GMT
FUnky izlupa:

> private void treeView1_MouseUp(object sender,
> System.Windows.Forms.MouseEventArgs e)
[quoted text clipped - 12 lines]
>
> }

Since after creating a node i do tv1.node("name").contextmenu =
contextmenuname

i just used this
> this.treeView1.SelectedNode = this.treeView1.GetNodeAt(e.X ,e.Y );

it never occured to me to select it manualy

thanks
PIEBALD - 12 Jul 2006 19:45 GMT
> private void treeView1_MouseUp(object sender,
> System.Windows.Forms.MouseEventArgs e)
[quoted text clipped - 8 lines]
>
> this.contextMenu1.Show(this.treeView1,new Point(e.X,e.Y));

This line seems unnecessary, works without it.

> }

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.