Whilst trying to convert the number from the value of a numericupdown to an int32 it is giving me the wrong number, ive stepped through and debugged it and it even shows as the numeric up down having a value of 3, yet the int it is being stored in is coming out as a 2. i really dont know why its doing this
int max = Convert.ToInt32(Sale.numericUpDown3.Value);
when debugging Value shows as 3, but max shows as 2, this means that later on when max is being used its retrieving data from the wrong row in my datatable. this happened to anyone before? :S
SOLVED: Ok so i figured this one out stepping through my code numerous more times, turns out what was happening was the moment the other form was created max became the value of when the form Started, not the value in it when the form was submitted, because the form when opened was usually 1 behind what it would be when submitted my max would be wrong, but that doesnt explain why 3 being converted came out as a 2, and here is the reason, the timing of my step through, the form started, max took on the value (2) then i changed the value of the numeric up down to 3, and looked THEN looked at my code, max was set at 2 as it understood it should have been but the numericupdown value showed me the CURRENT value of the numeric up down, not the value of it when it was used to give its value to max, hence i never saw the problem and wondered how the hell it did it, a bit of headscratching but a simple solution! thankyou to till who pointed out it could have been a timing issue, solved my problem!