Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now