|
-
May 23rd, 2004, 09:15 AM
#1
Thread Starter
Hyperactive Member
Select Case Scope
Are duplicate name declarations in a select case legal?
Code:
Select Case Msg
Case "Yes"
Dim sAnswer As String = "Yes"
Case "No"
Dim sAnswer As String = "No"
End Select
Reason I ask is because I notice if I do this, the IDE wont automatically format the name of the declaration , like so...
Code:
Select Case Msg
Case "Yes"
Dim sAnswer As String = "Yes"
MsgBox(sanswer)
Case "No"
Dim sAnswer As String = "No"
MsgBox(sanswer)
End Select
The IDE wont auto-Capitalise sanswer if I have more than 1 instance in the routine.. Just wondering..
-
May 23rd, 2004, 09:46 AM
#2
Simple answer : If the project doesn't compile, then its not legal.
Does it compile?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 23rd, 2004, 10:05 AM
#3
PowerPoster
Re: Select Case Scope
Originally posted by Hinder
Are duplicate name declarations in a select case legal?
Code:
Select Case Msg
Case "Yes"
Dim sAnswer As String = "Yes"
Case "No"
Dim sAnswer As String = "No"
End Select
Reason I ask is because I notice if I do this, the IDE wont automatically format the name of the declaration , like so...
Code:
Select Case Msg
Case "Yes"
Dim sAnswer As String = "Yes"
MsgBox(sanswer)
Case "No"
Dim sAnswer As String = "No"
MsgBox(sanswer)
End Select
The IDE wont auto-Capitalise sanswer if I have more than 1 instance in the routine.. Just wondering..
Have you tried your code? Cos it works OK. as it is.
If you declare sAnswer outside of the Select Case Block you will find the intellisense works as you expect.
Last edited by taxes; May 23rd, 2004 at 05:33 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 23rd, 2004, 10:24 AM
#4
Frenzied Member
The IDE's got weird quirks, doesn't mean your code won't work. I.e., if i have an if...end block, then put that in another if...end block, the IDE doesn't always format them out to the correct tabs. Usually they'll be ok the next time I load the project, but anyway, doesn't seem to break the code (that's my job!).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|