C
Cralis
I am trying to populate a ListView with a list of 'Models' of cars. I
have a data object class for my models, which has a function,
'getListOfModels', which I want to retuyrn a <List> of models.
In my data object, I have also created a class to hold each model, as
shown below.
No database work has been done. Just adding a model, and trying to
return it.
class clsDOModels
{
public static List<Model> getListOfModels()
{
SqlConnection sConn = clsDatabase.GetConnection();
List<Model> models = new List<Model>();
Model mod = new Model();
mod.id = 1;
mod.description = "Raptor";
models.Add( mod );
return models;
}
}
class Model
{
public int id;
public string description;
}
My calling form does this:
ModelParts.classes.clsDOModels.getListOfModels();
No runtime error, so it looks like it's working. My problem is, I'm
not sure how to get what ever is returned. That is, the <List>Models.
My calling form knows nothing about my 'Model' class from the data
object. So I am fundimentally doing something wrong, I think. How do I
declare what ever it is I am returning?
have a data object class for my models, which has a function,
'getListOfModels', which I want to retuyrn a <List> of models.
In my data object, I have also created a class to hold each model, as
shown below.
No database work has been done. Just adding a model, and trying to
return it.
class clsDOModels
{
public static List<Model> getListOfModels()
{
SqlConnection sConn = clsDatabase.GetConnection();
List<Model> models = new List<Model>();
Model mod = new Model();
mod.id = 1;
mod.description = "Raptor";
models.Add( mod );
return models;
}
}
class Model
{
public int id;
public string description;
}
My calling form does this:
ModelParts.classes.clsDOModels.getListOfModels();
No runtime error, so it looks like it's working. My problem is, I'm
not sure how to get what ever is returned. That is, the <List>Models.
My calling form knows nothing about my 'Model' class from the data
object. So I am fundimentally doing something wrong, I think. How do I
declare what ever it is I am returning?