|
-
Apr 15th, 2011, 02:58 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Treeview.ExpandAll - When is it done?
Ola,
I have loaded a treeview with files and folders. When I click on a folder which has a lot of subfolders and files this can take a while. Which event do I need to use to show a messagbox that the "expanding" is done? The is the same when I use Treeview.ExpandAll().
Thanks in advance.
-
Apr 15th, 2011, 03:17 AM
#2
Re: Treeview.ExpandAll - When is it done?
Are you talking about the AfterExpand event?
-
Apr 15th, 2011, 03:44 AM
#3
Thread Starter
PowerPoster
Re: Treeview.ExpandAll - When is it done?
Thanks, but no.
Example:
- Treeview is loaded with files and folders;
- When I click on a [+] to expand a folder I want to show: "expanding folder" on a label and when it is done expanding the folder: "done".
-
Apr 15th, 2011, 10:06 AM
#4
Re: Treeview.ExpandAll - When is it done?
 Originally Posted by Radjesh Klauke
Thanks, but no.
Example:
- Treeview is loaded with files and folders;
- When I click on a [+] to expand a folder I want to show: "expanding folder" on a label and when it is done expanding the folder: "done".
Actually, yes. You are looking for the BeforeExpand and AfterExpand events. This is a simulation of expanding a TreeView that takes time to process:
vb.net Code:
Public Class Form1 '//fields Private previousText As String '//event handlers Private Sub TreeView1_AfterExpand(ByVal sender As Object, _ ByVal e As TreeViewEventArgs) _ Handles TreeView1.AfterExpand e.Node.Text = Me.previousText '//you could do this, although you might just '//want to set the text back as it is annoying '//MessageBox.Show("Done") End Sub Private Sub TreeView1_BeforeExpand(ByVal sender As Object, _ ByVal e As TreeViewCancelEventArgs) _ Handles TreeView1.BeforeExpand Me.previousText = e.Node.Text e.Node.Text = "Expanding..." Application.DoEvents() Threading.Thread.Sleep(750) End Sub Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles Button1.Click '//make sure you add some nodes Me.TreeView1.Nodes(0).ExpandAll() End Sub End Class
-
Apr 18th, 2011, 07:08 AM
#5
Thread Starter
PowerPoster
Re: Treeview.ExpandAll - When is it done?
Thanks ForumAccount. +REP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|