my problem probably has a simple solution, but I am just not grasping it. Here's the situation, I wish to register a vehicle through several characteristics that are input in textboxes and so on, by the user, and stored in an array, so that he can then look up a vehicle, or alter certain characteristics of said vehicle.
Breaking it down in two-steps:
- First the user selects a value from a numericupdown and clicks a button, therefore defining the size of the array in use. This I did with the following code, which I do not know if it is 100% correct:
int aSize = Convert.ToInt32(numericUpDown1.Value);
int[] Viaturas;
Viaturas = new int[aSize];
- Now, the user has several TextBoxes, DateTimePickers and Comboboxes, where he inputs the characteristics of the vehicle. Then he clicks on a button and all that information gets stored in an array, in a way that each vehicle has it's characteristics stored, so that he is then able to look 'em up.
Assuming the first point is OK, the second one is where I struggle, I have no idea how to code this. Any ideas?
Thanks in advance!
Viaturas.Length + 1? Also you cant just reconstruct an array. You'll lose it. You have to copy it first.