Need Help Getting Info From One Class & Displaying In Program.Cs
need assistance or information on how to take information found in one class and link it into Program.cs.
It is a menu system, basically I want the user to be able to locate a vehicle (option 1) and when they enter option 1, all the relevant vehicle information is pulled from the vehicle class and displayed.
I need the application to display vehicleMake, vehicleModel, vehicleWeight and vehicleRegNo once option 1 is pressed. If anyone out there would be able to assist me and wants to take a look at the code, please reply in this thread and I will show you the code.
I have my vehicle details inside Program.cs
Say for example myDepots.AddVehicle(new Vehicle("Ford", "L9000", "200KG", "123"));
This is an example of 1 vehicle which is at the first depot, what I need the menu to do is when the user chooses option 1 (locate a vehicle), the user will enter "Ford" and the application will then look through the code and display:
"This vehicle is the Ford L9000 which has a capacity of 200KG and the regNo is 123."
If you know what I mean? I can post the actual code if someone is able to help, please bare in mind I'm a C# BEGINNER and am not knowledgeable of complex terms, so if someone is able to help and uses complex programming language, expect me to reply and ask for a more simplified version
Re: Need Help Getting Info From One Class & Displaying In Program.Cs
It would be better if you stored this data in a file or database because what your asking is to have all that data stored in memory while the application is running. Even if its just a few MB you don't want all that extra data loaded into memory. I'd suggest making a drop down box with the type and handle a change event for that list which fetches from the file or database extra info about that type. The initial change would trigger another drop down to appear with the options for make and year which would then add a button or enable it so they can submit the required data for querying. Then that data is used to fetch the results and your app would utilized less memory and be faster. Create a class that would allow you to add more types, models, makes, years, performance info etc... but not one that directly holds all that data in memory on program start. With that said you could then add things like images of the car, engine type, mpg, etc... in a separate table or if your using ravendb or xml different tag or page. Using an external data source would be best, where the code only has to do whats needed to retrieve, store, and display the data.
So in practice you'd have a selection list with the car type
when the user makes a selection from that list handle that event and query the database to get all the models for that make. This data would then be used to fill the newly created or visible list. You can have it there but only allow it to be viewed until after the first selection list has a value change.
Then they can select the model and year which would enable the button or display the button that sends the query request to the database for that specific car. You can add and option / checkbox that says lit all specs which would return all the data for that vehicle.
|All times are GMT +5.5. The time now is 17:52.|