samedi 28 février 2015

How to link an object to a row in a gridview using winforms API and C#?

I have a gridview. In addition to the standard column that are being displayed in the gridview, I want to capture unique data about some rows in the same gridview.


For example I want to link object XYZ with row #10. Also, I want to link object ABC to row #11 while row #1-9 does not have any objects linked to them but they have standard column information.



namepace RM
{
public class XYZ{
public string serialNum;
public string serviceLevel;
}

public class ABC{
public string insurancePlan;
public string phoneNumber;
}
}


how can I link the objects to a specific?


The way I have my application coded is "if a row has typeColumn == 'Electronic' then I display a form that captures the information for the object XYZ. "If a row has typeColumn == 'Insurance' then I display a form that captures the information for the object ABC.


How do I



  1. link each an object to to a single row? another instance of XYZ could be created for a different row. so row 10 and row 20 can have data for for XYZ.

  2. How do I read the data just before I do an INSERT into the database? my question is how to read the data not how to insert the data into the database.


Aucun commentaire:

Enregistrer un commentaire