Calling a Windows Form by its Class Name

I really do and work on VB.NET. My school uses VS2010, and I professionally use VS2012. When I need to call the window form in Mdicontainer in VS2010, I just use its class name, for example, for example:

 FormX.MdiParent = Me FormX.Show() 

But when I use VS2012, it seems I need to create an instance of my mdichild , like this:

 Dim form As New FormX() form.MdiParent = Me form.Show() 

My question is: am I just doing wrong or has VS changed the way you use WinForms?

+6
source share
1 answer

VS2012 VB.NET has instances by default, as in VS2010. Most likely, you have defined a custom Sub New () with a list of parameters, for example. Sub New(a As Integer) . If so, then the default instance is not created, you need to explicitly create the form.

+1
source

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


All Articles