Strange Select Case behaviour (2002)

  • Thread starter Thread starter madtom1999
  • Start date Start date
M

madtom1999

I'm using VS2002 and getting a strange problem

dim reqd as string="#Required"
dim str as string
select case str
case reqd
end select

displays in the editor with a twiddly line under the case with the
error : 'If', 'ElseIf', 'Else', 'End If', or 'Const' expected."
and it wont compile for the same reason!
Any clues as to how to fix this (and we use a lot of acces97 so I cant
upgrade vs.net)
 
I'm using VS2002 and getting a strange problem

dim reqd as string="#Required"
dim str as string
select case str
case reqd
end select

displays in the editor with a twiddly line under the case with the
error : 'If', 'ElseIf', 'Else', 'End If', or 'Const' expected."
and it wont compile for the same reason!

I do not have VS.NET 2002 installed, but the code compiles in VS.NET 2003.
 
I've found out that its a feature of the editor and the partial
compilation of the edit checking:
I cut and pasted the #required from a db into an already very long file
and it appears something got left in the partial compilation area -
closing that file and re-openeing it cleared the problem
 
on 2002 I can reproduce it:
in a vb file add:
Public Class play
Public Function play()
#REQUIRED
End Function
End Class

wait till the #REQUIRED is marked as a problem
then add
dim str as string=' and the closing 'to get
Public Class play
Public Function play()
dim str as String ='#REQUIRED'
End Function
End Class
and it wont compile!!!
 
on 2002 I can reproduce it:
in a vb file add:
Public Class play
Public Function play()
#REQUIRED
End Function
End Class

wait till the #REQUIRED is marked as a problem
then add
dim str as string=" and the closing "to get
Public Class play
Public Function play()
dim str as String ="REQUIRED"
End Function
End Class
and it wont compile!!!
 
on 2002 I can reproduce it:
in a vb file add:
Public Class play
Public Function play()
#REQUIRED
End Function
End Class

wait till the #REQUIRED is marked as a problem
then add
dim str as string=' and the closing 'to get
Public Class play
Public Function play()
dim str as String ='#REQUIRED'
End Function
End Class
and it wont compile!!!


Well, the code is not actually valid! You'll have to use double quotation
marks to delimit the string instead of the single quotation marks.
 
That was a typo - I'd asked the psot to be removed but to no avail!
 
That was a typo - I'd asked the psot to be removed but to no avail!

Okay. "news.microsoft.com" doesn't accept 'CANCEL' requests.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top