c# - Multiple TextBox to Array -
my problem has simple solution, not grasping it. here's situation, wish register vehicle through several characteristics input in textboxes , on, user, , stored in array, can vehicle, or alter characteristics of said vehicle.
breaking down in two-steps:
- first user selects value numericupdown , clicks button, therefore defining size of array in use. did following code, not know if 100% correct:
int asize = convert.toint32(numericupdown1.value); int[] viaturas; viaturas = new int[asize];
- now, user has several textboxes, datetimepickers , comboboxes, inputs characteristics of vehicle. clicks on button , information gets stored in array, in way each vehicle has it's characteristics stored, able 'em up.
assuming first point ok, second 1 struggle, have no idea how code this. ideas?
thanks in advance!
it sounds want create object store data in.
public class vehicle { public vehicle(string make...) { make = make; ... } public string make; public string model; public string year; public string color; ... }
then can use list
store vehicles, handle size of array you:
list<vehicle> vehicles = new list<vehicle>(); vehicles.add(new vehicle(textboxmake.text, ...));
and access them like:
textboxmake.text = vehicles[0].make;
wiki
Comments
Post a Comment