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:

  1. 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]; 

  1. 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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -