Problem with getting List to tree view control in - WeOnlyDo Discussion board

Problem with getting List to tree view control in (wodSFTP / wodSFTP.NET / wodSFTPdll)

by computermarshal, Wednesday, November 23, 2005, 09:48 (6754 days ago)

I get list of files ,
sftp.ListDir( /html );
Then I try to add it to treeview control ,
treeview.Nodes.Add( dirname );
But it give me exception.

The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using Control.Invoke or Control.BeginInvoke to perform this action.

What the hack is with the control. How to solve this.
Plz Plz Plz.. help me.

Re: Problem with getting List to tree view control

by wodSupport, Wednesday, November 23, 2005, 09:59 (6754 days ago) @ computermarshal

This problem isn't related to wodSFTP.NET at all. Error says it all - you must populate ListDir from different thread, probably main thread.

Re: Problem with getting List to tree view control

by computermarshal, Wednesday, November 23, 2005, 10:04 (6754 days ago) @ wodSupport

This problem isn't related to wodSFTP.NET at all. Error says it all - you must populate ListDir from different thread, probably main thread.


So how to to this. because I want it to be in

private void sftp_ListItemsEvent(object Sender, SFTP.ListItemsArgs Args)

Re: Problem with getting List to tree view control

by wodSupport, Wednesday, November 23, 2005, 10:06 (6754 days ago) @ computermarshal

Well, obviously it cannot. This isn't wodSFTP's limitation, this is TreeView's limitation.

So, you could store it to some collection, and then populate it from main thread using that collection.