OK, Sorwen told me to think about how classes might be useful in my app even though I've seriously cut back on my plans to use them. So I'm thinking of new and better ways to use the classes I've already designed for my railroad program.
As I'm making progress on some of the routines that actually work with the data, it seems to me a good use of a class would be to instantiate it and read in a specific record from a data table that I need to process on. For instance, I have some processing to do involving a specific train. If I load the train record from the DB into an instance of the Train Class I made, I easily have access to the fields as properties, and could create methods that would, for instance, Update the Location property of the train in the DB by passing in the new location variable.
Since I will need to refer to the Train information several times during this process, it seems to make sense to me to do it this way rather than creating a bunch of local variables and reading the record into them field by field. Right?
If that's so, how can I create a class object based on the record I want to instantiate without having to create objects for the entire table?
Thanks
CraigHartz
As I'm making progress on some of the routines that actually work with the data, it seems to me a good use of a class would be to instantiate it and read in a specific record from a data table that I need to process on. For instance, I have some processing to do involving a specific train. If I load the train record from the DB into an instance of the Train Class I made, I easily have access to the fields as properties, and could create methods that would, for instance, Update the Location property of the train in the DB by passing in the new location variable.
Since I will need to refer to the Train information several times during this process, it seems to make sense to me to do it this way rather than creating a bunch of local variables and reading the record into them field by field. Right?
If that's so, how can I create a class object based on the record I want to instantiate without having to create objects for the entire table?
Thanks
CraigHartz