Solved

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

Posted on 2009-05-04
1
4,237 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
[X]
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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
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…

734 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