473,732 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cant set "Treeview.Selec tedNode" from different thread

Hi,

I'm current having a problem with the treeview control and multi
threading. The treeview is on a form. A request is then sent to a
server using IP for the data. The data arrives in an event on a
different thread. I have used delegates to allow me to add to the
treeview and it all works fine. I cant however seem to set the
"SelectedNo de" property or the treeview. I have tried directly and
also using a delegate. I all cases, the UI freezes for a while, then
the thread times out.

Below is a snippet of the code I have already. Does anyone have any
ideas? Any help is very much appreciated. In the
"SelectTreeview RootNode" call, I have tried using the passed in
treeview, and the actual name of the one on the form, but neither
works.

Delegate Sub TreeViewSelectR ootNodeDelegate (ByVal trvTreeview
As TreeView)

Private mdgtSelectRootN ode As New
TreeViewSelectR ootNodeDelegate (AddressOf SelectTreeviewR ootNode)

Private Sub SelectTreeviewR ootNode( _
ByVal trvTreeview As TreeView)

tvwMain.Selecte dNode = tvwMain.Nodes(0 )
End Sub

tvwMain.Invoke( mdgtSelectRootN ode, New Object() {tvwMain})

Cheers

Bobby Owens
Bo*********@ntl world.com
Nov 21 '05 #1
0 1318

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

Similar topics

3
821
by: feel | last post by:
Goin' crazy with this recursive function ported from delphi... I send a string like DirA/ DirB /DirC but i get in the treeView each one in a new node.Cant get the child node....!! -DirA -DirB -DirC instead of: DirA | - DirB
4
1895
by: Tim Geiges | last post by:
I have created a treeview for my app that on MainFormLoad I have it get the list of drives with GetLogicalDrives() and populate the tree, then when I click the drive it adds the first level of folders on that drive, then click a folder and it adds the next level of folders under the first, and so on. That part works perfectly with one flaw. but here is the flaw: When I add the next sub node it adds the entire path to the Node.Text the...
0
901
by: charliewest | last post by:
I need to simulate a TreeView control in my asp.net application. It's not necessary to actually show the + and - symbols, and lines that connect the varying levels. All i need is to be able to show a primary listing w/ multiple columns, and then a sub-listing w/ multiple columns and rows. I have seen some basic show/hide functions on the web, basically using DHTML to show and hide layers, however, i need a more robust control (if there is...
3
10152
by: Jan Wrage | last post by:
Hi! I would like to implement a treeview in my existing application. It should show my entire Active-Directory structure, i.e. all Groups, Containers and OUs. Could somebody help me with that. Im trying for about 3 hours but can't get it to work. Thank you!
0
1141
by: MrNobody | last post by:
I want to display different menu item options depending on what the user right-clicks on the tree. I cant figure out how though, I currently tried to create separate ContextMenu objects in a class which inherits from TreeView, and then in it's MouseClick event I do: protected override void OnMouseClick(MouseEventArgs e) { TreeNode node = this.GetNodeAt(e.Location); this.SelectedNode = node;
3
1720
by: bg_ie | last post by:
Hi, Lets say I have a TreeView with nodes that represent objects of a number of different types. Is there a way of associating the Set method of each object with its node in the TreeView? That way when you select a node in order to change its associated data, you have easy access to its Set function. The way I normally handel this situation is is to create an enum of all the different types that the treeview contains. I then have a
1
3270
by: Steve | last post by:
Hello! How can I realize, that when the Cursor is over an TreeNode, that the TreeNode will be underlined. I think the code must be in the "TreeNodeDataBound" Event, or? Regards Steve
0
7169
by: Dennis Francek | last post by:
Hello I have populated a treeview from my dataset and by clicking in the treeview i want to get the corresponding table shown in a datagridview. Ive managed this by looking at each DataRow and child rows and added the nodes with a columnname from each datarow. At the same time i have put in a tag at each treenode with a filter string and the current table im looking at as a string to use for later so i can create a datatable and set a filter...
4
4996
by: frostbb | last post by:
I have a C# WinForms treeview with 20 or so 'level 0' nodes. My users will normally have 2 of the 'level 0' branches open down to a '5th level' selected node. The users will make updates to the 2 selected nodes that will alter the node name. I think I need to rebuild the TreeView to get everything synchronized after they click an update button.
0
8774
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
9447
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
9307
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
9235
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
8186
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
6735
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
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
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
3
2180
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.