Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2004, 09:25 AM
Registered User
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Variable Declarations

I am doing a very simple page to change the background color of the page based on a checked radio button. I'm using VS.NET, so putting the code-behind. The problem is that when I declare my variable in the HTML page, the code-behind page doesn't recognize the declaration and won't compile, and when I put it in the code-behind page, I get this error when it try to view the page:

BC30390: 'LearningSite.RadioButtonAutoPostBack.strBackGroun dColor' is not accessible in this context because it is 'Private'.

We'll, it is NOT private. I didn't put it into anything that says "Private" Here is what it looks like:

--------------------------------------------------------

Public Class RadioButtonAutoPostBack
    Inherits System.Web.UI.Page
    Dim strBackGroundColor As String = "white"

    Public Sub BackColor_Changed(ByVal s As Object, ByVal e As EventArgs)
        strBackGroundColor = s.Text
    End Sub

End Class

-----------------------------------------------------------

What now?


 
Old July 30th, 2004, 09:49 AM
Registered User
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah, trial and error. My favorite method of programming. As it turns out, all I had to do was drop the word "Public" in front of my Dim statement and viola! It works.

Off to create more problems now... :-)

The more I learn, the less I know.





Similar Threads
Thread Thread Starter Forum Replies Last Post
When to use NEW in declarations LarryMoore BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 8 September 24th, 2008 04:02 PM
Why do API Declarations Incr. .EXE size? BrianWren Pro VB 6 6 December 21st, 2007 03:23 PM
Where are my control declarations? Ron Howerton ASP.NET 2.0 Basics 13 December 6th, 2007 03:11 PM
Chap 18 XML,error: multiple DOCTYPE declarations cJeffreywang BOOK: Beginning ASP 3.0 1 November 9th, 2005 03:54 PM
retaining ENTITY declarations arvin XSLT 3 July 23rd, 2003 01:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.