vb.net playing with numbers challenge
Posted on 2011-05-09
I have DatagridView that the user can press a "add" button and via textboxes he enters values.
the grid has columns like that:
From1 To1 From2 To2 From3 To3 (until 5) ..
i have 10 textboxes in the same way.
fact1: All textboxes are MaxLength of 3 (only numbers) (0 to 999)
fact2: From1 and To1 must have numbers in it.
fact3: if from2,3,4,5 and to2,3,4,5 are blank I consider that its the MIN inside the from (0) to the MAX inside the TO (999)
fact4: you need both values in from1,2,3,4,5 and in to1,2,3,4,5 not just a from or a to you know..
fact5: The From needs to be always less than the To...
if your first Row is : From1: 1000 and To1 :1500
you cannot add another Row From1 1100 to To1 1600 because 1100 is already between 1000 and 1500.
same thing, lets say you add a new row with from1 900 to 1600 well it cant because between 900 to 1600 there are numbers already inside 1000 to 1500.. you get it ?
now the tricky part...
if you had the same 1000 to 1500 in the second row, it can be fine only if the From2 and To2 are different
if from2 and to2 are the same, you need to go see if from3 to to3 are different... etc until 5 you know?
so im not sure and to do all that.. im quite lost...can you help ?