473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[ASP.NET 2.0] Select Case

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
Nov 19 '05 #1
3 3756
Oh, and I especially like the piece of IntelliSense help that says;

"When casting from a number, the value must be less than infinity" - hehe, I
started typing that number in - but got bored :oD

Rob
Nov 19 '05 #2
I hate it when two minutes later I post an answer to my own question - damn
my lack of RTFM skills!

a comma instead of the word Or seems to do the trick...

"low", "1"
"medium", "2"

*sigh*

Rob
Nov 19 '05 #3
Have you tried this:

Select case XMLTextReader.ReadInnerXml.ToLower
Case "low", "1"

Case "medium", "2"

Case "high", "3"

End Select

"Rob Meade" <te**************@edaem.bbor> wrote in message
news:2h********************@text.news.blueyonder.c o.uk...
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

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: amoona | last post by:
Hi… I’m doing a search page form my work for their library. Since this is the first time I work with ASP I’m facing some problems. Each library item has different search data, I was able to...
4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
11
by: Steve Hoyer | last post by:
I am trying to deploy my first asp.net app to our webserver (2K server, IIS 5) My start page comes up and you can get to the subsequent pages that are tied into our sql server (2K). Each page...
7
by: Patrick.O.Ige | last post by:
I have an old way of doing this in ASP below.. Can anybody help to change this to ASP.NET.. THannks!! <script runat="server"> ' Insert page code here Dim l, d, c 'Read in the querystring...
1
by: Chumley Walrus | last post by:
I'm changing an old classic asp script over to asp.net; it displays links corresponding to each day of the week <script runat="server"> Sub Page_Load(s As Object, e As EventArgs) ...
1
by: sreemati | last post by:
Hi Everyone, I have newly started as a ASP developer. I have been working on some change request and was blogged down with dynamic includes. Eventually I had managed to figure out the problem and...
1
by: hotflash | last post by:
Hi Master CroCrew et All, I am working on a CASE statement to allow different type of searches to search for different type of projects. EVERYTHING WORKS FINE EXCEPT, if the "Any Projects" radio...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.