Question Saving, loading and using settings

nymm

New member
Joined
Feb 9, 2015
Messages
1
Programming Experience
Beginner
Hi,

I'm working on a small-scale educational project for children to practice the conversion of metric units of measurement (e.g. 300 cm = ... m).

The program consists of a main form in which the exercises are displayed, and a settings form containing:


  • a drop-down box with the names of the pupils (and optionally a button to modify the list of pupils)
  • checkboxes to select which physical quantities are to be tested (lenght, weight, volume, etc.)
  • for each physical quantity, a varying number of checkboxes to select which units are to be tested (mm, cm, dm, m, km, etc.)
  • checkboxes for some additional options, such as the use of fractions and combination exercises (160 cm = 1 ... and 6 ...)

The selected settings are saved for each individual pupil, to avoid having to reconfigure everything between each session.

Now, I am by no means a professional programmer. I always end up with a working piece of software, but the code behind it is usually somewhere between laughable and lamentable. So before delving into this project, I figured I'd better ask some advice first on how to go about things. Here's what I had in mind:

The settings are to be saved in a number of seperate ini-files. There is one file with the names of all the pupils, and then an additional file for each pupil, containing the selected settings for that pupil as a series of 1's and 0's. When the program is started, the user has to select which pupil is going to make the exercises. The appropriate ini-filed is read into memory, and the string of 1's and 0's is converted into usable data. I'm thinking of using a set of arrays for this. A one-dimensional array lists the physical quantities to be tested, and an additional two-dimensional array for each physical quantity lists the units to be tested, as well as the relative order of magnitude of each unit. This would allow me to generate the exercises by randomly selecting a physical quantity in the first array, and then two different units in the corresponding two-dimensional array. Next, a random value is selected (between certain predetermined limits) for the smallest of the two units, and then converted into the higher unit using the relative order of magnitude of the two. Finally, the program randomly selects which element from the equation is to be supplied by the pupil, after which the exercise is displayed using a number of labels and a textbox.​

When the settings form is opened, the checkboxes are preconfigured according to the data in the arrays. Upon leaving the settings screen, if the configuration has been modified, the arrays are reset to reflect the new settings, and the data in the appropriate ini-file is overwritten.​

Like I said, I'm confident I can get the program to work as intended using this approach, but I'm also pretty sure this is nowhere near how it ought to be done. For one thing, I should probably make use of objects and find a more structured way of storing data. So if anyone is willing to point me in the right direction, it would be greatly appreciated!

Kind regards,

nymm
 
Top Bottom