This is in C#. The concept would apply to
VB.Net or any other OO language such as Java though.
I have a form that displays data in combo boxes and text boxes from a data base. It lets the user navigate via the combo boxes. Based on the statistics of the records, it performs an algorithm to come up with a score.
Anyways, thats the main form the user uses. I have another form to add more records. The statistics for the new records are all generated radomly except one field. On this form, I have a button to genereate a new set of random stats if they don't like the ones they have been given. But I only give them 3 chances to go with what they want.
This is my problem: I need my program to remember how many times a user has generated new random statistics. If they've done it more than 3 times, they will have to close out the program and re-open it to 'cheat.'
This is some rough pseudocode of what happens (intCount keeps track of how many times a user has re-generated random stats):
On Create Reocrd Click:
--->Open frmCreate modally
------>Enter/Save new Records
------>On frmCreate.Closing
--------->Cancel closing
--------->Hide frmCreate
--->Add intCount from frmCreate to intCount on frmMain
--->Destroy frmCreate
--->Requery for new records on frmMain
End
When frmCreate is hidden, it allows frmMain to go on with its process, the first of which is adjusting the intCount figure so I can keep track of it for the duration of the program. If I would have not cancelled frmCreate's closing, then I would have lost frmCreate's intCount.
This works great, but....I am thinking there should be a better method for this. When frmMain is once again the visible form, you can see the form being repainted from the top to the bottom, kind of like a java applet.
Before I was keeping track of and letting users create an infinate number of random stats, when frmCreate would close, frmMain would be on the screen without that 'repainting' effect.\
Its a minor thing, and I can live with it, but I was just wondering if anyone had any ideas.