I think you are missing the idea of a string.
Is actually creating an array of strings, that is you are creating 10 different strings. You are not actually creating a string that can have 10 characters. If you add a breakpoint to this line of code and hover over it you will see something like this:Code:Dim array(9) As String
array(0) =""
array(1) =""
array(2) =""
array(3) =""
etc etc
Just use 1 string:
Then extract the first 5 characters as you have done, but check the size of the string first:Code:Dim strMyNumber As String = rand.Next
Code:Dim HiOrder As String = "" Dim LoOrder As String = "" If strMyNumber.Length > 5 Then HiOrder = strMyNumber.SubString(0,5) LoOrder = strMyNumber.SubString(5) 'anything on from 5 Else HiOrder = strMyNumber LoOrder = "0" 'Not enough numbers to fill lo order End If
Note, untested![]()




Reply With Quote
