Combining 2 forms


Apr 11, 2005
Programming Experience
i'm new to Vb.NEt.
I created 2 different Vb.NEt projects initially (both design form and code). Now i want to join those 2 forms into one project. So what i did was opened a new project; right clicked on the projects name in the 'solution explorer'; add a new item; added windows form.

so in my new project i have 2 forms. i copied and pasted the design and code for those 2 forms.

Now my question is How to i join them or make them work together. i.e., i want to take a value from a variable or text box in one form and use in in the other?
how do i do that?

any help is greatly appreciated
There are many other threads in this forum that answer the same question. Accessing variables always comes down to scope. You have to be able to see a variable from the places you want to use it. If one of your forms is opening the other, it can pass required values in the constructor. Otherwise, you need to declare your variables somewhere visible to both forms, like in a Module. A Module is like a Class where all members are Shared, so they are accessible by any object in your project. Also, it would have been better to use "Add Existing Item" rather than "Add New Item" and then copying code. It is much less error-prone.

Latest posts