Solved

Referencing a method from another namespace

Posted on 2006-10-30
3
274 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
3 Comments
 
LVL 13

Accepted Solution

by:
joechina earned 125 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Error 2 62
Replace &lt; with < 14 59
Getting error in connectionstring with Excel. 30 30
FTP file download using c# 3 22
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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

19 Experts available now in Live!

Get 1:1 Help Now