I’m sure this is a simple task but it is escaping me right now as to how I should best implement it.
I have (Or will have!) a window defined in the app which has various listboxes, buttons and other controls. This window represents an ‘event’ or ‘incident’ and will be used to enter and then store details of said event/incident. I will actually name this window as ‘incidentform’ in the main app code.
The user then needs to be able to open multiple instances of the ‘incidentfform’ and work on them one at a time without necessarily closing existing ones first, and where needed switch between the open windows. Im assuming they need to be modeless for this to work but I cant picture in my head how to open multiple instances of this same window over and over as needed. The maximum number of instances will most likely be 6 or 7.
Is there a recommended way to do this correctly ?
Start by turning off the window behavior Implicit Instance in the window settings. This is used mainly when only one window of this type is necessary.
Then when you want a new instance (for example in response to a New menu event) place the code
Dim incident as new incidentform
A new window will be created for each New menu selection.
Works a treat Jim, thankyou. I knew there would be a straight forward solution. Sometimes I think about coding so much that the basics take a leave of absence.
Glad I could help.
Implicit Instance lowers the initial learning curve but can be limiting and cause unexpected results.
What I will do at the appropriate time and once the form is complete is to test the compiled program with a simple loop to create 10 of said window instances just to be sure and see what happens.
In what way do you consider the change of implicit instance to be limiting ? Its something I have never really looked at or needed to change before now.
Thanks Jim, I’ll do some reading there.