R
Rob Meade
Ok - I *think* this is only different in .net 2.0 - as I've not had any
problems in the past, but then maybe I've not tried it...
I have a value being read from an xml file where the value maybe a word or a
number, ie...
Low or 1
Medium or 2
High or 3
I have a select case statement as follows:
select case XMLTextReader.ReadInnerXml.ToLower
case "low" or "1"
case "medium" or "2"
case "high" or "3"
end select
as soon as I step past the "case low or 1" line it error with a message
about not being able to convert a string to a long...
If I do this:
select case XMLTextReader.ReadInnerXml.ToLower
case "1"
case "2"
case "3"
case "low"
case "medium"
case "high"
end select
it works fine - I dont understand?!
xmlReaderValue is declared as a string, the 1 is in quotes - thus a string
(right?).. so at which point does it think - oh yes - a long?
I even have a .ToLower on the end of the XMLTextReader.ReadInnerXml.ToLower
line so surely that would give some other kinda error if it wasn't a string?
Any help appreciated, I know I can do this a different way, but I'd like to
understand why this isn't working.
Cheers
Rob
problems in the past, but then maybe I've not tried it...
I have a value being read from an xml file where the value maybe a word or a
number, ie...
Low or 1
Medium or 2
High or 3
I have a select case statement as follows:
select case XMLTextReader.ReadInnerXml.ToLower
case "low" or "1"
case "medium" or "2"
case "high" or "3"
end select
as soon as I step past the "case low or 1" line it error with a message
about not being able to convert a string to a long...
If I do this:
select case XMLTextReader.ReadInnerXml.ToLower
case "1"
case "2"
case "3"
case "low"
case "medium"
case "high"
end select
it works fine - I dont understand?!
xmlReaderValue is declared as a string, the 1 is in quotes - thus a string
(right?).. so at which point does it think - oh yes - a long?
I even have a .ToLower on the end of the XMLTextReader.ReadInnerXml.ToLower
line so surely that would give some other kinda error if it wasn't a string?
Any help appreciated, I know I can do this a different way, but I'd like to
understand why this isn't working.
Cheers
Rob