Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-05-04
1
Medium Priority
?
4,414 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 420 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

610 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