declared or not declared ?

J

JohnZing

I'm usinf asp 2.0 and visual studio 2005

In html
<img id="selcolorimg" runat="server" name="selcolorimg"
src="image4.jpg">

I want to use selcolorimg in code behind, but vs2005 throws an error
"selcolorimg is not declared"

Ok, i tried to insert

Protected selcolorimg As HtmlImage

BUT, NOW i get a new error
'selcolorimg' is already declared as 'Protected Dim WithEvents
selcolorimg As System.Web.UI.HtmlControls.HtmlImage' in this class.

Declared where?? So, why vs2005 says is not declared??
 
T

Terry Burns

Well it's clear that it is declared otherwise you would not get this error.
The question is why intellisense is not recognising the fact when you are
trying to use the variable. Try saving all. Recompiling the entire project,
and restarting 2005 and see if it appears in intellisense.
 
J

JohnZing

Thank you Terry!
I had to restart vs2005. Now it works! Lost 2 hours searching and
trying to figure out whats wrong with my code :( I feel so stupid... oh
well..
 
J

Jon Paal

There is a bug in VS, where it keeps trying to declare items which don't need to be declared

The solution is to save work and close VS, then reopen VS, big pain in rear.
 

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

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top