Form.Show() and Form.ShowDialog()

0.00 avg. rating (0% score) - 0 votes

Form.Show() is an asynchronous call. Subsequent section of codes will run while the form is being loaded. Form.ShowDialog() is a blocking call – it will block until the form is closed.


In VB.NET, if we access a form directly without creating any instance (e.g. Form.Show()), .NET will automatically create 1 instance of the form for use. Even if the form is not visible, the instance continue to stay in memory until we call Form.Close().


This is not possible in C#, however. In C#, we must explicitly declare an instance of the form:


Form myForm = new Form();
myForm.Show()

0.00 avg. rating (0% score) - 0 votes
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>