473,805 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comment renommer une Node d'un TreeView en VB2005 ?

Bonjour je cherche à renommer une node d'un TreeView mais ça ne fonctionne pas.
Malgré un Nodes.Find qui me retourne bien le Node en cours avant changement de son nom,
et qui grace à cela je récupère aussi l'index.
Ci-joint code non fonctionnel

Merci.
If MessageBox.Show ("Etes-vous certain de vouloir Renommer ce répertoire [" & strVal & "] ?", "Renommer répertoire", MessageBoxButto ns.OKCancel, MessageBoxIcon. Warning) = DialogResult.OK Then
Dim TreeRen() As TreeNode = Me.DirTreeView. Nodes.Find(strV al, True)
For i As Integer = 0 To UBound(TreeRen)
If TreeRen(i).IsVi sible Then
Dim indexNode As Integer = TreeRen(i).Inde x ' Retourne bien l'index correspondant

Dim frmModif As New frm_Saisie
frmModif.tb_Val Name.Enabled = False
frmModif.tb_Val Name.Text = Strings.Mid(str Val, strVal.LastInde xOf("\") + 2)
frmModif.tb_Val .Text = Strings.Mid(str Val, strVal.LastInde xOf("\") + 2)
frmModif.ShowDi alog()
'*** 1er Essai ne fonctionne pas non plus Element inexistant ?
Me.DirTreeView. Nodes.Item(inde xNode).Text = frmModif.tb_Val .Text
Me.DirTreeView. Nodes.Item(inde xNode).Name = Strings.Left(st rVal, strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text
'*** Autre Essai ne fonctionne pas non plus Element inexistant ?
'TreeRen(i).Tex t = frmModif.tb_Val .Text
'TreeRen(i).Nam e = Strings.Left(st rVal, strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text
'Me.DirTreeView .Nodes.RemoveAt (indexNode)
'Me.DirTreeView .Nodes.Insert(i ndexNode, TreeRen(i))

lvw_Reg.Items.I tem(ilv).Text = frmModif.tb_Val .Text
lvw_Reg.Items.I tem(ilv).SubIte ms(1).Text = Strings.Left(st rVal, strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text
IO.Directory.Mo ve(strVal, Strings.Left(st rVal, strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text)
frmModif.Dispos e()
End If
Next
End If
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

Jun 27 '06 #1
1 1621
Claude,

This is a English language newsgroup, most visitors are from countries all
over the world, from which for a major part English is not their first
language. However we are used to do the conversation in English.

There is a newsgroup special for French to, it has a much simpler name

microsoft.publi c.dotnet.vb

As an advice, try to make a litle sample instead of a copied part of your
program with even outcommented code in it. That makes it easier to help you.

By instance replace all string variables as much as possible by hard
strings. Probably the chance that you than find the problem yourself is very
high..

I hope this helps something

Cor

"claude" <No*********@gm ail.com> schreef in bericht
news:11******** ********@proxy0 2.news.clara.ne t...
Bonjour je cherche à renommer une node d'un TreeView mais ça ne fonctionne
pas.
Malgré un Nodes.Find qui me retourne bien le Node en cours avant
changement de son nom,
et qui grace à cela je récupère aussi l'index.
Ci-joint code non fonctionnel

Merci.
If MessageBox.Show ("Etes-vous certain de vouloir Renommer ce répertoire ["
& strVal & "] ?", "Renommer répertoire", MessageBoxButto ns.OKCancel,
MessageBoxIcon. Warning) = DialogResult.OK Then
Dim TreeRen() As TreeNode =
Me.DirTreeView. Nodes.Find(strV al, True)
For i As Integer = 0 To UBound(TreeRen)
If TreeRen(i).IsVi sible Then
Dim indexNode As Integer = TreeRen(i).Inde x '
Retourne bien l'index correspondant

Dim frmModif As New frm_Saisie
frmModif.tb_Val Name.Enabled = False
frmModif.tb_Val Name.Text = Strings.Mid(str Val,
strVal.LastInde xOf("\") + 2)
frmModif.tb_Val .Text = Strings.Mid(str Val,
strVal.LastInde xOf("\") + 2)
frmModif.ShowDi alog()
'*** 1er Essai ne fonctionne pas non plus
Element inexistant ?
Me.DirTreeView. Nodes.Item(inde xNode).Text =
frmModif.tb_Val .Text
Me.DirTreeView. Nodes.Item(inde xNode).Name =
Strings.Left(st rVal, strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text
'*** Autre Essai ne fonctionne pas non plus
Element inexistant ?
'TreeRen(i).Tex t = frmModif.tb_Val .Text
'TreeRen(i).Nam e = Strings.Left(st rVal,
strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text
'Me.DirTreeView .Nodes.RemoveAt (indexNode)
'Me.DirTreeView .Nodes.Insert(i ndexNode,
TreeRen(i))

lvw_Reg.Items.I tem(ilv).Text =
frmModif.tb_Val .Text
lvw_Reg.Items.I tem(ilv).SubIte ms(1).Text =
Strings.Left(st rVal, strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text
IO.Directory.Mo ve(strVal, Strings.Left(st rVal,
strVal.LastInde xOf("\") + 1) & frmModif.tb_Val .Text)
frmModif.Dispos e()
End If
Next
End If
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

Jun 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6064
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 nodes. In this one, I have an operation of Renaming a Project Node. So whenever I am doing the...
13
9067
by: André Nogueira | last post by:
Hi there. I know you can view a node's fullpath property, but is it posible to select a node using its path? Like, tell the treeview that the node that should be selected is the node with the path "Users\Administrators\John Doe"? Thank you in advance! Andre Nogueira
3
9643
by: Sergio Terenas | last post by:
Hi all, I've a Treeview control in a form load with 600 nodes. Each node has a text and tag associated to it at the time I add it. I need to find a node by either the text or the tag, make it the SelectedNode and then make sure it's visible on the tree. I've been playing with the treeview's properties/methods but I think I got stuck. Dim aKey As String = txtKey.Text Dim a As Integer
0
12794
by: jiing | last post by:
Hi all, I want to use sting(the same as Node.Text) to judge if a node exists in TreeView. I've tried several ways, but seems all failed. could anybody help me? Thanks in advance. //My TreeView is defined to has depth =3 only.
0
9596
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9186
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.