I have so many form in different module in one solution.
I already instantiate a new Form as a global variables in my parent form.
Then, call the code


in my button1 event
any idea?

i cant understand wat you are trying to say

I want my all form will be called in one instance. For example, I have form1 and form2. Every time I click the button in form1 to show form2, it will check if form2 is already open or not. If open, then will just set the form2 to front and otherwise show a new form2. Hope you understand. God bless!

simple solution. don't make new instance of form2. on button click write
if you have any parent form then write this code on that menustrip click event
Form2.MdiParent = Me
try it works

Try using the following

CType(frmMyForm, frmMyForm).Show()

Hope this works :)

I use generic codes because I have so many forms to show. I tried all your suggestion but still it didn't work. My forms information are stored in a database so if I want to show a certain form all I need to do is call the function showForm(ComponentName).Inside this function, I initialize a variable

Dim extForm As Form

Any idea?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.