Solved

Member modifier 'public' must precede the member type and name

Posted on 2009-05-04
1
4,199 Views
Last Modified: 2012-05-06

Hello.

I am trying to declare a boolean variable in C# that is public. I keep getting this error message though. Can someone help me figure out what I am doing wrong?

Error      32      Member modifier 'public' must precede the member type and name      C:\KMR\KRMMasterPage.master.cs      10      5      C:\KMR\

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class KRMasterPage : System.Web.UI.MasterPage
{
 
    public bool isVisible; // Public must precede the member type and name
    protected void Page_Load(object sender, EventArgs e)
    {
       isVisible  = false;
    }
}

Open in new window

0
Comment
Question by:brgdotnet
1 Comment
 
LVL 9

Accepted Solution

by:
tculler earned 140 total points
ID: 24299910
Sometimes the compiler issues really strange errors for things that are actually caused by other problems. Here's a few ideas that may cause freak-errors:

 - You haven't included your code within a namespace
 - isVisible may conflict with a previous member of System.Web.UI.MasterPage
 - If this class is implemented in another file, the error may be caused there, but manifesting here, especially if that class is nested within a namespace in that other file (I say this because you've delcared this class as "partial").
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question