Hi Leon
Thanks Cor,
Your code is much better, but just for better understanding could
you please explain the following line of code:
For I = 0 To txtBoxes.Length - 1
txtBoxes is an Array filled with TextBoxes.
Dim txtBoxes As Textbox() = New Textbox() {Textbox1, Textbox2)
txtBoxes.Length give you the count of TextBoxes that are within that
Array.
In this example there are two Boxes, so the count of txtBoxes is 2.
Each Array begins with 0, means the first entry can be called through
txtBoxes(0) : <- Is TextBox1
So now you can use 'For Next' to access all entry in that array.
You must use txtBoxes.Length - 1 cause the Array-Counter is 2 (two
entries).
If you are using:
For I = 0 to txtBoxes.Length
you will get an error : Index out of range cause txtBoxes(2) isn't
defined.
txtBoxes.Length - 1, this line could also written as:
For I = 0 to 1
Next
But this way isnt good code cause if the array count changed you have
to change the 'For Next' loop too.
Try to find some documentation about VB.net using,creating,accessing
Arrays
Hope you undestand that explanation a bit.
Frank