Declaring Form Objects

Question:
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.

Answer:
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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: