[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Referencing a method from another namespace

Posted on 2006-10-30
3
Medium Priority
?
283 Views
Last Modified: 2010-04-16
I must be missing something simple! Please help before I start banging  my head against my desk!!! I am referencing a method in a class from a different namespace. I cannot pick up my other method with the intellisense in the class that I am trying to call it fromHere is some sample code below:

using mytest2.x

namespace mytest
{
public class ServerOptions : System.Windows.Forms.Form
    {
          //***I can't this line below to appear in intellisense
           ExcelPreferences
    }
}

**************************************************
This code below is another .cs file:
**************************************************

using System;
using System.Collections.Generic;
using System.Text;

namespace mytest2.x
{
    class ExcelPreferences
    {
        const string constEnableViewDataInExcel = "EnableViewDataInExcel";
        const string constDefaultViewDataInExcel = "true";

        public ExcelPreferences()
        {

        }

        /// <summary>
        /// Gets or sets the boolean for the enable function.
        /// </summary>
        public static bool EnableViewDataInExcel
        {
            get
            {
                RegistryPreferences m_pPreferences = new RegistryPreferences();
                return (bool.Parse(m_pPreferences.GetPreference(constEnableViewDataInExcel, constDefaultViewDataInExcel)));
            }
            set
            {
                RegistryPreferences m_pPreferences = new RegistryPreferences();
                m_pPreferences.SetPreference(constEnableViewDataInExcel, value.ToString());
            }
        }
    }
}
0
Comment
Question by:lmred
[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
3 Comments
 
LVL 13

Accepted Solution

by:
joechina earned 500 total points
ID: 17835239
your class ExcelPreferences is private.
Change it to public
0
 
LVL 6

Expert Comment

by:der_jth
ID: 17835454
Actually, ExcelPreferences is internal (that is the default visibility for top-level classes). But yes, making it "public class ExcelPreferences" will do the trick, as will compiling both the files into a single assembly (csc /out:myprog.exe first.cs second.cs, or making them a single project in Visual Studio).
0
 
LVL 1

Author Comment

by:lmred
ID: 17835734
I don't believe this!!! I wasted hours on such a stupid mistake. I didn't even notice that because I thought the default was public. Thanks so much guys!!!

Lmred
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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 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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 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