Any way to easily cancel a Winform from opening?


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
How can I cancel the creation or opening of a form, from within the form? I.e. I'd like to validate the configuration of the form and if it fails, cancel the opening of the form and I'd like to throw an exception. This is mostly so the form is opened correctly by code (not the user). The validation might be done in a constructor or in the load event handler. Is there any way to do that?
Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
In the second case I would also need to use a try/catch block on the .Show or .ShowDialog call, right?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, the method will be thrown from within the Show() or ShowDialog().  You are correct Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search