❔ How to Initialize different forms using same piece of code
I have this piece of code and i want to use it for different forms. In this case i can't initialize the form directly using its name like
`customForm frm = new customForm();'
and i tried using the 'Form' class which is more general. Problem is that initializing forms using the 'Form' class does not work properly. How can i make this function work with different classes?8 Replies
You probably want
Form form = new CustomForm()
?No that won't work. I want this function to work with multiple forms, not just one, like customForm
Why won't that work exactly?
I'm a little confused by the code in your question. I'm not sure what it's trying to do -- is it trying to show a form, or create one? If it's trying to create one, why are you passing one in?
Its trying to create form and if it already exists, just show it. I am passing the form that i want to create/show
So basic question: You only want one placeholder for a form which can be filled with any of those 5 forms? Or do you want to be able to hold 5 placeholders, one for each form and check against those?
The first one
Well you cannot overwrite
frm
in your method of course. You need to have some placeholder outside of the method to preserve a formWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.