Hi all
I have a question abount renaming a selected treenode.
My user can place the cursor on a treeview, click on the right button of the
mouse, and a contextmenue is beeing populated, in which he can Add, rename
or delete a node from the treeview.
When he select the new option, the code I use is:
treeview1.Nodes .Add("New")
When he select the delete option, the code I use is:
treeview1.Nodes .Remove(treevie w1.SelectedNode )
When he select the rename option, I need a code no let him change the
selected node's name.
How can I do it?
thanks 4 14632
ohad weiss wrote:
Hi all
I have a question abount renaming a selected treenode.
My user can place the cursor on a treeview, click on the right button of the
mouse, and a contextmenue is beeing populated, in which he can Add, rename
or delete a node from the treeview.
When he select the new option, the code I use is:
treeview1.Nodes .Add("New")
When he select the delete option, the code I use is:
treeview1.Nodes .Remove(treevie w1.SelectedNode )
When he select the rename option, I need a code no let him change the
selected node's name.
How can I do it?
thanks
If you want to change the text (rename) of the selected node use:
TreeView1.Selec tedNode.Text = "Your new text"
LS
Hi Lloyd ,
Thanks for your reply, but it seems that you didn't understand me.
I need to let my user rename it from the treeview itself, means, He stand on
the relevant node, click on it and it allow him to change it's name (like as
you rename a folder in the windows explorer)
"Lloyd Sheen" <a@b.cwrote in message
news:uB******** *****@TK2MSFTNG P06.phx.gbl...
ohad weiss wrote:
>Hi all
I have a question abount renaming a selected treenode. My user can place the cursor on a treeview, click on the right button of the mouse, and a contextmenue is beeing populated, in which he can Add, rename or delete a node from the treeview.
When he select the new option, the code I use is:
treeview1.Node s.Add("New")
When he select the delete option, the code I use is: treeview1.Node s.Remove(treevi ew1.SelectedNod e)
When he select the rename option, I need a code no let him change the selected node's name.
How can I do it?
thanks
If you want to change the text (rename) of the selected node use:
TreeView1.Selec tedNode.Text = "Your new text"
LS
ohad weiss wrote:
Hi all
I have a question abount renaming a selected treenode.
My user can place the cursor on a treeview, click on the right button of the
mouse, and a contextmenue is beeing populated, in which he can Add, rename
or delete a node from the treeview.
When he select the new option, the code I use is:
treeview1.Nodes .Add("New")
When he select the delete option, the code I use is:
treeview1.Nodes .Remove(treevie w1.SelectedNode )
When he select the rename option, I need a code no let him change the
selected node's name.
How can I do it?
thanks
I've used something like this:
Private Sub treeview1_KeyUp (ByVal sender As Object, ByVal e As System.Windows. Forms.KeyEventA rgs) Handles treeview1.KeyUp
'
' Catch special key F2
'
If e.KeyCode = Keys.F2 Then
treeview1.Label Edit = True
treeview1.Selec tedNode.BeginEd it()
End If
End Sub
Private Sub treeview1_After LabelEdit(ByVal sender As Object, ByVal e As System.Windows. Forms.NodeLabel EditEventArgs) Handles treeview1.After LabelEdit
'
' Handle edited label and disable label edit
'
treeview1.Label Edit = False
If e.Label Is Nothing OrElse e.Label.Trim.Le ngth = 0 Then
' Can not be empty text
e.CancelEdit = True
End If
End Sub
Does not exactly answer, how to do it from the context menu, but I hope you'll get the idea.
- Timo
Hi ohad,
You call BeginEdit on the node. Also make sure that the treeview has
LabelEdit set to True
"ohad weiss" <oh***@netvisio n.net.ilwrote in message
news:eU******** *****@TK2MSFTNG P06.phx.gbl...
Hi Lloyd ,
Thanks for your reply, but it seems that you didn't understand me.
I need to let my user rename it from the treeview itself, means, He stand
on the relevant node, click on it and it allow him to change it's name
(like as you rename a folder in the windows explorer)
"Lloyd Sheen" <a@b.cwrote in message
news:uB******** *****@TK2MSFTNG P06.phx.gbl...
>ohad weiss wrote:
>>Hi all
I have a question abount renaming a selected treenode. My user can place the cursor on a treeview, click on the right button of the mouse, and a contextmenue is beeing populated, in which he can Add, rename or delete a node from the treeview.
When he select the new option, the code I use is:
treeview1.Nod es.Add("New")
When he select the delete option, the code I use is: treeview1.Nod es.Remove(treev iew1.SelectedNo de)
When he select the rename option, I need a code no let him change the selected node's name.
How can I do it?
thanks If you want to change the text (rename) of the selected node use:
TreeView1.Sele ctedNode.Text = "Your new text"
LS
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Benny Raymond |
last post by:
More problems with this... When I run this code, the main form returns
an invalid cast exception as it's executing the line "TreeNode n =
(TreeNode) this.Nodes;"
Does anyone know what would cause this? I just want to be able to use
my own node class so that I can store extra data...
=========================
|
by: Saradhi |
last post by:
Hi All,
Here I am facing a performance problem with the TreeView Node renaming.
I am displaying a hierarchy Data in a treeview in my Windows C# Application.
My tree view represents an hierarchical view of Parent Nodes and projects where in a projectnode can be added to any ParentNode and hence we may have a project node added to 100 Parent...
|
by: naija naija |
last post by:
Hi All,
I'm using the TreView Web Control for my MENU.
And the Menu is populated from an XML file below.
I want a way in which i can manipulate the XML when i want to manage it
without having to open the file all the time.I tried creating an
application in ASP.NET but its difficult getting an exact node to
delete,insert etc b-cos of the XML...
|
by: fred |
last post by:
I am using the clipboard to copy and paste a TreeNode but the Tag property
does not seem to be copied.
I use the Tag property for an Object that contains data relating to the
TreeNode. The Tag property is fine when the TreeNode is put onto the
Clipboard but the Tag property is always 'nothing' when I take the TreeNode
from the Clipboard.
...
|
by: Rothariger |
last post by:
Hello....
i want to know if its posible to rename multiple files like windows does..
example:
file zzzzzzz.doc
file asdasd.doc
file esfsefse.doc
| |
by: tanya foster |
last post by:
Hello,
I am re-writing a visual basic .net application(visual studio 2003) in an
asp.net application(visual studio 2005). The vb.net application relied on a
treeview and hence, treenodes. The treeview and treenode class in asp.net
is limited compared to vb.net's. In vb.net, the treenode had a nextnode
property which was equivalent to...
|
by: divya1949 |
last post by:
Create a windows c# application which will
Read a xml file and populate nodes in the treeview.
1 On selection of treenode display the child nodes of that node in listview control
2. Provide following view properties to listview, through View menu
a. Tile
b. Icon
|
by: jmDesktop |
last post by:
I am trying to add nodes with keys to my treeview. I can add general
nodes without problem with:
//create new node
TreeNode newNode = new TreeNode(myIdNumber);
//create children
TreeNode myPersonNode = new TreeNode(myPerson);
TreeNode myAddressNode = new TreeNode(myAddress);
|
by: AAaron123 |
last post by:
If you see this posted twice - sorry.
My news reader showed my first post as "No Longer Available"
I have the following in a .css file.
The treeNodes behave as if they were "a" elements.
I can't get them to not respond to the mouse!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |