Declaring Form Objects

Declaring Form Objects

If i declare a new form as an object variable,

Dim NewForm as Formset NewForm=form2NewForm.Show
Once I have a one of those forms, how do refer to that particularinstance of the form in the code? NewForm and form2 produce a syntax error.

Let’s say that fRealForm is actually a form in your project. If you do:

Dim NewForm as New fRealFormNewForm.Show
That will work, and show fRealForm. If you call the two lines again, it will create a new instance of that form. You will probably run into trouble just dimming things as Form. It doesn’t work very well for object variables…it works ok for passing parameters.


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist