declared or not declared ?

Discussion in 'ASP .Net' started by JohnZing, Feb 5, 2006.

  1. JohnZing

    JohnZing Guest

    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??
     
    JohnZing, Feb 5, 2006
    #1
    1. Advertising

  2. JohnZing

    Terry Burns Guest

    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.

    --
    Terry Burns
    http://TrainingOn.net

    "JohnZing" <> wrote in message
    news:...
    > 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??
    >
     
    Terry Burns, Feb 5, 2006
    #2
    1. Advertising

  3. JohnZing

    JohnZing Guest

    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..
     
    JohnZing, Feb 5, 2006
    #3
  4. JohnZing

    Jon Paal Guest

    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.


    "JohnZing" <> wrote in message news:...
    > 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??
    >
     
    Jon Paal, Feb 5, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kent Johnson

    Not declared..?

    Kent Johnson, Oct 19, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    583
    Natty Gur
    Oct 20, 2003
  2. Guoqi Zheng

    Name 'DiffGram' is not declared.

    Guoqi Zheng, Jan 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    387
    Guoqi Zheng
    Jan 12, 2004
  3. TJS

    "name not declared" but it is

    TJS, Feb 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    5,950
    vMike
    Feb 3, 2004
  4. Scott M.
    Replies:
    2
    Views:
    546
    Kevin Spencer
    Feb 5, 2004
  5. lostlander
    Replies:
    5
    Views:
    437
    Keith Thompson
    Dec 10, 2007
Loading...

Share This Page