kwh3856
asked on
'System.FormatException...........Convert from String to Boolean
I am reading data from a flat file. The data in the field is a 0. I am reading it in as a String value because if the data does not exist, the fill the location with a blank. I then try to covert it to a boolean value but get a system.format problem. What could be causing this problem.
Thanks
Kenny
Here is the code
Dim migrant As String
migrant = Val(Mid(strLine, 102, 1))
migrant = Convert.ToBoolean(migrant)
Thanks
Kenny
Here is the code
Dim migrant As String
migrant = Val(Mid(strLine, 102, 1))
migrant = Convert.ToBoolean(migrant)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Once again.....THANK YOU..
Thanks
Kenny
Thanks
Kenny
anytime, let me know if you need anything further.
Cheers,
Greg
Cheers,
Greg
instead use
dim foo as integer = Convert.ToInt(migrant)
dim val as boolean = (foo = 1)