What is the difference between the following forms display methods?

What is the difference between the following two operations (in terms of memory management):

Dim frm as New MyForm() frm.Show() 

VS

 MyForm.Show() 

I am originally a C # developer, how does the second make sense or even compile in this case in VB.NET? (Show () is not a Shared / Static method) What happens in the second case?

+3
source share
1 answer

MyForm.Show () is a hold from versions of VB6 and previous versions for compatibility reasons. These versions usually did not create multiple instances of the form, so when MyForm.Show () was used, it automatically created a single instance of the form for use by default. You should not use this method and the preferred instance creation method and call the .Show () method, this is the right way and is compatible with C # and other .net languages.

+5
source

Source: https://habr.com/ru/post/952111/


All Articles