Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
GeneralRe: datagridview filtering....where to start? Pin
mprice21420-May-10 10:12
mprice21420-May-10 10:12 
GeneralRe: datagridview filtering....where to start? Pin
Stanciu Vlad20-May-10 10:22
Stanciu Vlad20-May-10 10:22 
GeneralRe: datagridview filtering....where to start? [modified] Pin
mprice21424-May-10 8:24
mprice21424-May-10 8:24 
GeneralRe: datagridview filtering....where to start? Pin
Stanciu Vlad25-May-10 21:12
Stanciu Vlad25-May-10 21:12 
GeneralRe: datagridview filtering....where to start? Pin
mprice21426-May-10 7:48
mprice21426-May-10 7:48 
GeneralRe: datagridview filtering....where to start? Pin
Stanciu Vlad26-May-10 10:05
Stanciu Vlad26-May-10 10:05 
GeneralRe: datagridview filtering....where to start? Pin
mprice21426-May-10 17:43
mprice21426-May-10 17:43 
GeneralRe: datagridview filtering....where to start? Pin
Stanciu Vlad26-May-10 20:43
Stanciu Vlad26-May-10 20:43 
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...

GeneralRe: datagridview filtering....where to start? <Solved> Pin
mprice21426-May-10 18:52
mprice21426-May-10 18:52 
GeneralRe: datagridview filtering....where to start? Pin
Stanciu Vlad26-May-10 20:54
Stanciu Vlad26-May-10 20:54 
GeneralRe: datagridview filtering....where to start? Pin
mprice21427-May-10 3:13
mprice21427-May-10 3:13 
GeneralRe: datagridview filtering....where to start? Pin
Stanciu Vlad27-May-10 6:52
Stanciu Vlad27-May-10 6:52 
QuestionXML Serialization of derived classes Pin
Roland Bär7-May-10 12:35
Roland Bär7-May-10 12:35 
AnswerRe: XML Serialization of derived classes Pin
Peace ON7-May-10 21:40
Peace ON7-May-10 21:40 
AnswerRe: XML Serialization of derived classes Pin
Stanciu Vlad7-May-10 23:20
Stanciu Vlad7-May-10 23:20 
Questionhow can i make a distributed system through C# ? Pin
Med7at7-May-10 11:30
Med7at7-May-10 11:30 
AnswerRe: how can i make a distributed system through C# ? Pin
Garth J Lancaster7-May-10 13:43
professionalGarth J Lancaster7-May-10 13:43 
AnswerRe: how can i make a distributed system through C# ? Pin
Member 41702067-May-10 15:04
Member 41702067-May-10 15:04 
GeneralRe: how can i make a distributed system through C# ? Pin
Med7at7-May-10 15:47
Med7at7-May-10 15:47 
AnswerRe: how can i make a distributed system through C# ? Pin
Peace ON7-May-10 19:44
Peace ON7-May-10 19:44 
Questionreturn number of records selected Pin
Abdul-Rhman Alsri7-May-10 11:21
Abdul-Rhman Alsri7-May-10 11:21 
AnswerRe: return number of records selected Pin
Dr.Walt Fair, PE7-May-10 12:27
professionalDr.Walt Fair, PE7-May-10 12:27 
AnswerRe: return number of records selected Pin
Member 41702067-May-10 15:07
Member 41702067-May-10 15:07 
AnswerRe: return number of records selected Pin
Peace ON7-May-10 19:53
Peace ON7-May-10 19:53 
AnswerRe: return number of records selected Pin
Saiyed Alam7-May-10 20:42
Saiyed Alam7-May-10 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.