473,396 Members | 1,913 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.

syntax for Select Case statements

ST
Hi, I'm trying to debug someone else's code, and I'm going thru this Select
Case statement. I'm having problems with the "OTHER" case...in that when the
first line of the case is false, it jumps to the end of the select case
block, instead of finishing going thru the rest of the cases (and thereby
reaching the next "OTHER" case). Can anyone explain this to me?? Thanks!
I've put ***** where things seems to mess up!

Select Case dr("SUBCATEGORY").ToString
Case "Developmental Delay"
If Not dr("CHOICE").ToString = "NA" Then
lblNS_DD.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblNS_DD_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
Case "Hypotonia"
If Not dr("CHOICE").ToString = "NA" Then
lblNS_H.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblNS_H_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
******Case "OTHER" (if this is false, it goes to the very end of this whole
block!)
If dr("MAIN_CATEGORY") = "Musculoskeletal" Then
If Not dr("CHOICE").ToString = "NA" Then
lblMS_O.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA"
Then
lblMS_O_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
End If
'General Developmental
Case "Language Delay"
If Not dr("CHOICE").ToString = "NA" Then
lblGD_LA.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblGD_LA_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
Case "Learning Disability"
If Not dr("CHOICE").ToString = "NA" Then
lblGD_LE.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblGD_LE_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
Case "ADHD/ADD"
If Not dr("CHOICE").ToString = "NA" Then
lblGD_AD.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblGD_AD_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
Case "Behavioral Problems"
If Not dr("CHOICE").ToString = "NA" Then
lblGD_BP.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblGD_BP_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
******** Case "OTHER" (passes over this Case and all those above/below)
If dr("MAIN_CATEGORY") = "General Developmental" Then
If Not dr("CHOICE").ToString = "NA" Then
lblGD_O.Text = dr("CHOICE").ToString.ToUpper
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA"
Then
lblGD_O_F.Text =
dr("IS_FAMILY_HISTORY").ToString.ToUpper
End If
End If
'Lab Test Results
Case "Elevated Transaminases"
If Not dr("CHOICE").ToString = "NA" Then
lblLTR_ET.Text = dr("CHOICE")
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblLTR_ET_F.Text = dr("IS_FAMILY_HISTORY")
End If
Case "Aldolase"
If Not dr("CHOICE").ToString = "NA" Then
lblLTR_A.Text = dr("CHOICE")
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA" Then
lblLTR_A_F.Text = dr("IS_FAMILY_HISTORY")
End If
Case "MAX CPK 1ST VALUE"
If Not dr("CHOICE").ToString = "NA" Then
lblLTR_CPK1.Text = dr("CHOICE")
End If
Case "MAX CPK 2ND VALUE"
If Not dr("CHOICE").ToString = "NA" Then
lblLTR_CPK2.Text = dr("CHOICE")
End If
Case "OTHER"
If dr("MAIN_CATEGORY") = "LAB TEST RESULTS" Then
If Not dr("CHOICE").ToString = "NA" Then
lblLTR_O.Text = dr("CHOICE")
End If
If Not dr("IS_FAMILY_HISTORY").ToString = "NA"
Then
lblLTR_O_F.Text = dr("IS_FAMILY_HISTORY")
End If
End If
***** End Select (it goes here and continues on below)

If dr("VALUE_ID").ToString = "CVID-502" Then
If dr("CLINICAL_VALUE_OTHER_NOTE").ToString = "" Then
lblVS_O_Text.Text = ""
Else
lblVS_O_Text.Text =
dr("CLINICAL_VALUE_OTHER_NOTE").ToString
End If
End If
If dr("VALUE_ID").ToString = "CVID-500" Then
If dr("CLINICAL_VALUE_OTHER_NOTE").ToString = "" Then
lblMS_O_Text.Text = ""
Else
lblMS_O_Text.Text =
dr("CLINICAL_VALUE_OTHER_NOTE").ToString
End If
End If
If dr("VALUE_ID").ToString = "CVID-504" Then
If dr("CLINICAL_VALUE_OTHER_NOTE").ToString = "" Then
lblGD_O_Text.Text = ""
Else
lblGD_O_Text.Text =
dr("CLINICAL_VALUE_OTHER_NOTE").ToString
End If
End If
If dr("VALUE_ID").ToString = "CVID-506" Then
If dr("CLINICAL_VALUE_OTHER_NOTE").ToString = "" Then
lblLTR_O_Text.Text = ""
Else
lblLTR_O_Text.Text =
dr("CLINICAL_VALUE_OTHER_NOTE").ToString
End If
End If
Next
Jul 21 '05 #1
1 1994


ST wrote:
first line of the case is false, it jumps to the end of the select case
block, instead of finishing going thru the rest of the cases (and thereby
reaching the next "OTHER" case). Can anyone explain this to me?? Thanks!
I've put ***** where things seems to mess up!


Are you saying that it executes the first block marked "OTHER" and then
skips every thing else? I think that behavior is by design,

Looking at the IL for a select case, it appears that at the end of each
block it puts a jump to the end of the select case. In effect, once it
enters a case block, it doesn't even check the other conditions
anymore.

Probably the simplest solution is to just combine the code from both
"OTHER" blocks. This would be more readable anyway.

Jul 21 '05 #2

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
41
by: John Marshall | last post by:
How about the following, which I am almost positive has not been suggested: ----- class Klass: def __init__(self, name): self.name = name deco meth0: staticmethod def meth0(x):
9
by: Kevin | last post by:
Hi, I am getting a syntax error Microsoft VBScript compilation error '800a03ea' Syntax error On the code below. The error references the "End Select" line Can anyone help me with what I am...
14
by: bolidev | last post by:
I'm new to SQL and can't figure out how to update my table (StoreItemStatus) that contains the current status for items in each store (STORE_KEY, ITEM_KEY, STATUS,...). I get updated status info...
1
by: Amit D.Shinde | last post by:
Hi Experts, i am writting a stored procedure in sql server 7. Its a simple stored procedure It is my first stored procedure. I want insert a record in table if the primary key field user id...
8
by: Jan van Veldhuizen | last post by:
The UPDATE table FROM syntax is not supported by Oracle. I am looking for a syntax that is understood by both Oracle and SqlServer. Example: Table1: id name city ...
5
by: What-a-Tool | last post by:
Have a group of dynamically created text boxes in a calendar like grid. At the head of each column, the textbox is to contain the day of the week. Now I am using a Select Case statement to...
2
by: Marco Lazzeri | last post by:
What about a SELECT syntax like that? SELECT CASE WHEN bar.foo_id IS NULL THEN bar.* ELSE foo.* FROM foo, bar Anyway, I need a SELECT query that gets data from a FIRST TABLE if a specific...
2
by: ST | last post by:
Hi, I'm trying to debug someone else's code, and I'm going thru this Select Case statement. I'm having problems with the "OTHER" case...in that when the first line of the case is false, it jumps...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.