[RESOLVED] Forms and Close() method
Hi all!!
I am developing a Windows based application using VS 2005.
I have a main form with a main menu on it and I use the menu items to call other forms of the application. When one of the menu items is clicked a form (which I call Form1) is called using the ShowDialog method. Then on this form there is a button that when clicked calls another form using ShowDialog again (called Form2). Form2 has a button that when clicked I call the Close() method to close the form. This way Form2 is closed but at the same time Form1 is closed too and I can not understand why. And I don't want this to happen. After displaying some info on Form2 I want to continue using Form1.
Any idea?? Please help ASAP....
Re: Forms and Close() method
I was unable to reproduce the described behaviour. Maybe you could post a small project showing the problem?
- petter
Re: Forms and Close() method
I cannot see why this would happen but...
One thing, rather than calling Form.Close() would be to assign the Forms 'CancelButton' property (in the designer) to the [Close] button and see if this cures your problem.
Re: Forms and Close() method
Show us the code. You are doing something to cause it, but we can't know what that is.
Re: Forms and Close() method
Quote:
Originally Posted by
BigEd781
Show us the code.
Show me the money!!! :eek:
Heh, yep, it's not possible to do this unless you have a mistake in your coding. Close() does not effect Owners.
Re: Forms and Close() method
Thank you all for your time!!
I couldn't figure out what the problem was but after I tried some different things, I deleted the button that called Form2 on Form1 and recreated it and no problem remained:)))
Thank you again!