D
Dave Cullen
I have a program that reads a delimited text file and splits the input
string into string array elements:
Dim Data(41) as String
'read semicolon delimited fields into string array
Data = SrRead.ReadLine().Split(";".ToCharArray)
I expect up to 40 elements to be read. But if the input data string has
less than that and I try to access Data(40) I get a
System.IndexOutOfRange exception. I thought that declaring the array
size first would take care of that.
I know I can GetLength on the array and know how big it is. But is there
a way to statically set the array bounds so I don't need to know?
Thanks
string into string array elements:
Dim Data(41) as String
'read semicolon delimited fields into string array
Data = SrRead.ReadLine().Split(";".ToCharArray)
I expect up to 40 elements to be read. But if the input data string has
less than that and I try to access Data(40) I get a
System.IndexOutOfRange exception. I thought that declaring the array
size first would take care of that.
I know I can GetLength on the array and know how big it is. But is there
a way to statically set the array bounds so I don't need to know?
Thanks