|
-
Jan 10th, 2004, 10:51 AM
#1
Thread Starter
Hyperactive Member
Problem with Events
Hey all, i am using a small form containing a listbox.
Now what I want to do is if the user double clicks an Item in the listbox, some code will happen and then the form closes.
So I added the doubleClick Event and tried
this.close();
Calling the close method I guess call the dispose method right?
Now I always get an Exception in the dipose method saying Object listbox cannot be accessed.
So, how can close the form from this event?
Thanks Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Jan 10th, 2004, 12:55 PM
#2
PowerPoster
I need code to play wih it on my computer to see what is wrong.
-
Jan 10th, 2004, 01:29 PM
#3
Thread Starter
Hyperactive Member
Well all you need are two forms. The first one just opens the second one. On the second form add a listbox to it.
then in your private void InitializeComponent()
add this:
Code:
this.listbox.DoubleClick+= new System.EventHandler(this.ListBox_DoubleClick);
and then add the EventHandler:
Code:
private void ListBox_DoubleClick(object sender, EventArgs e)
{
this.Close();
}
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
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
|