Vb.net refers to the form created by the program through New

I have the following code in vb.net written by a button.

dim x as new frm_raw_infosheet

whenever I click the button, the program creates a new instance of the form that I want.

My question is: how can I access each of the newly created forms? for example, I pressed the button 3 times, how do I programmatically hide the second form that I created with the button?

I tried

x.name = "Form" & incrementingvariable

however, I am not quite sure how I will refer to it.

To make my question more clear, let incrementingvariable contain the number 2

incrementingvariable = 2

x now contains the name "Form2"

however this returns an error

Form2.enabled = false 

I cannot reference Form2 because .Net says that "Form2" does not exist!

EDIT

I understand that some time has passed since I asked about it, but here is the update

, Listbox1.items.add(x.Name).

? , ?

+5
2

: ListBox Form:

Listbox1.Items.Add(x)

DisplayMember ListBox Name, ( ).
ListBox :

DirectCast(ListBox1.Items(2), Form).Enabled = False

ListBox (, , , , Count ).
, Form, , Form.

+1

, , .

, , , new , . . .

, , new , .

+3

All Articles