I have a program that I wrote in VB6 many years ago that worked well. However, I am required to move all the applications to .NET. I'm still very new at this, and programming is not my main job. I'm an Air Traffic Controller :) I've searched extensively, but nothing seems to cover all the points I need. My apologies if I've missed something. I can handle all the coding for manipulating the data, it's the creation and removal of the controls dynamically that has me baffled.
The program runs 24/7. It has a Tab Control with a single default tab page. Each page has a number of controls (in .NET, these would be text boxes, labels, buttons and datagridview, probably two of each). The program reads a database every 60 seconds looking for a specific entry. When this entry is found, it checks to see if there's a tab page for the entry. If it exists, the data is added to the existing tab page if it isn't already there.
If the entry doesn't exist, a new tab page is built using all controls from the original tab page, positioned the same and the same appearance, and must be user and program accessible. The user interacts with each tab by adding to or editing data fields, and can declare a tab page "closed" from further data entry.
Finally, at the end of the day (usually about 1AM local) all tabs except the original are cleared to start the day fresh. I also run an archive on the database, but that much I've figured out.
The major change from my VB6 app is the loss of control arrays. I've written a couple of other apps that build controls dynamically at startup, but they are static once the program is loaded. Creating and removing all these controls when I have no firm idea what they will be named when they are created is tough. The constant for each new tab is the event name, which would be formatted as a 3-6 character location name and a six digit date, with a colon and sequential number added at the end. That's because the event location could have more than one event during the day.
If anyone needs more specific information about what I am tracking, I'll be happy to expand. Just trying to keep it short for now. To keep some functionality that has been depreciated in .NET, I am sticking with the 3.5 framework.
Plutonix suggested a perfect solution that I hadn't considered, and is far more practical than what I was doing.
Rather than creating and destroying all these controls, have a main form with a grid showing each event. The grid row can be colored to show status (active, closed and requiring attention). Double-clicking on a row opens a second form with the necessary controls to interact with that particular event. The DGV control can be databound, which simplifies editing a field.
I've done some quick experimentation with this method, and it will do everything I needs without all the headaches.
Thanks for all the suggestions. All ideas appreciated. :)