Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2009-05-04
1
4,153 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

861 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