Avatar of sirbounty
sirbountyFlag for United States of America asked on

VS2010 warning help

Getting the warning in my code and not sure how to clean it up properly.
Warning	2	WithEvents variable 'UniqueID' conflicts with property 'UniqueID' in the base class 'Control' and should be declared 'Shadows'.	

Open in new window


This came in shortly after I added
<asp:HiddenField id="UniqueID" runat="server" value=""/> in my default page, and
 If Not IsPostBack = True Then
            Dim GuidString As String = Guid.NewGuid.ToString
            Session("HiddenKeyString") = GuidString
            UniqueID.Value = GuidString
        End If

Open in new window

in my code behind.  I've used this in another project without any additional steps, so I'm unsure why it's causing an issue now.
ASP.NET.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
sirbounty

8/22/2022 - Mon
joriszwaenepoel

You should change the name because UniqueID is a property for the Control Class in ASP.NET.
Paul Jackson

That's because the control class which is derived by hiddenfield already has a property called uniqueid. Change the id of your hidden field to something else and it will be fine.
ASKER
sirbounty

Consider me a beginner... what do you mean it's a property for the control class?  Have I duplicated something that's embedded natively?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
joriszwaenepoel

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
sirbounty

And so it did - thanks for the quick help.