Beginners question regarding switching between forms
Posted on 2004-11-23
I have only been programming with VB.NET for a few weeks with some previous experiance in VB6, but certainly not an expert. I am trying to write a windows app that will involve a lot of changing between forms, with one form disappearing as the next opens with the hope that it will seem like one seamless window where only the controls change. The code that I have figured out for this is something like (if I wanted to open From2 for example):
Dim f2 as new Form2
'some other formatting commands here
This seems to work OK (although please tell me if there is a better way), but I would like to have this code as a seperate module so that I don't have to keep retyping with every form switch. My main question is, if I need to dimension a new "Form2" to tell Form2 to open, how do I pass the information "Form2" to the module? If I pass the text "Form2" as a string variable the module doesn't know it is a Type, yet I can't pass a type to the module.
Please ask me to clarify if this doesn't make sense, I apologise if some of the terminology is wrong - still trying to get my head around it all. Cheers,