mainData is the place where the data is stored. I said that you could persist this in a database. So if you did that then your table would look like that: with a reference to the ValueType table and a referece to the ValueUnitOfMeasurement on each row. If you comment out all the mainData columns you would not have a place where to store the data entered in the grid and the grid would be empty. So, if you add different types of measurements and do not bind them correctly the application will crash. In all the tables the ID column must be unique (numbers from 1 to n). In the valueUnitOfMeasurement table there is an ID column (that must be unique) and a reference to a valueType (stated in the valueType table). The reference is the ID of the valueType. Let's assume you want to add a new measurement type named "Distance" with the units of measurement "km", "m", "cm", "mm". The first step is to add the record in the ValueType table:
valueType.Rows.Add(new object[] {100, "Distance"});
Note that the row added is [100, "Distance"] - 100 is the Distance's ID (must be unique in the table). Next you must add records in the ValueUnitOfMeasurement table:
valueType.Rows.Add(new object[] {500, 100, "km"});
valueUnitOfMeasurement.Rows.Add(new object[] {501, 100, "m"});
valueUnitOfMeasurement.Rows.Add(new object[] {502, 100, "cm"});
valueUnitOfMeasurement.Rows.Add(new object[] {503, 100, "mm"});
Note that the first row added is [500, 100, "km"] - 500 is the UnitOfMeasurement's ID and 100 is the valueType's ID correspondind to this unit of measurement (A couple of lines above we stated that for distance 100 is the ID). The logic in my previous example filters the unit of measurements based on the selected value type ID in the valueType combo box. This supports an logically unlimited number of measurement types and units of measure. Also this supports persistance (database or xml).
I have no smart signature yet...