Hi all,
I'm pretty new to VB.net, having only recently migrated from VB5(!). I'd appreciate any help at all with the following problem that I have on a project;

I'm reading data in from a comma-separated text file and storing the data in an array for later use. Some of the values are to remain as strings, and I need to convert some to integers, for which I was trying to use, for example, integer.parse(ar(0)).

My problem is that the string values are randomly distributed through the text file, so I need to be able to test whether the string can be converted at all before doing the conversion.

So - can anyone tell me if there is there a way to do this, or should I be looking for an alternative method?

Thanks, Gavin

8 Years
Discussion Span
Last Post by jlego
if isnumeric(myArray(x)) = true then

try and catch could be used to, but isnumeric is easier.


Excellent! Very many thanks - that part of things now works like a dream.

I considered about try and catch, although I didn't go for it in the end because it seemed like it would be so ungainly that there ought to be something better obviously, there was...

Thanks again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.