hello,
I want to create a class in a library:
public class GetHello
{
private string aa = "Hello world";
public GetHello()
{
//
// TODO: Add constructor logic here
//
}
public string GetContent()
{
return aa;
}
}
Then I create a simple project and I want to use the GetContent to return
the string.
What I did was to add a reference to the dll created by the library class,
from the Projects tab.
then I create an object:
MyData_Object myObj = new MyData_Object() ;
trying to use myObj, it does not see the method I created earlier:
GetContent
Thank you 6 1675
I forgot to mention:
namespace MyData_Object
{
}
"Daniela Roman" <da**********@r ogers.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
hello,
I want to create a class in a library:
public class GetHello
{
private string aa = "Hello world";
public GetHello()
{
//
// TODO: Add constructor logic here
//
}
public string GetContent()
{
return aa;
}
}
Then I create a simple project and I want to use the GetContent to return
the string.
What I did was to add a reference to the dll created by the library
class, from the Projects tab.
then I create an object:
MyData_Object myObj = new MyData_Object() ;
trying to use myObj, it does not see the method I created earlier:
GetContent
Thank you
Daniela,
>public class GetHello
[...]
>MyData_Objec t myObj = new MyData_Object() ;
trying to use myObj, it does not see the method I created earlier: GetContent
So is the class called GetHello or MyData_Object?
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Hello Daniela,
Have u pointed "using" statement with the namespace where your class locate?
DRI forgot to mention:
DR>
DRnamespace MyData_Object
DR>
DR{
DR>
DR}
DR>
DR"Daniela Roman" <da**********@r ogers.comwrote in message
DRnews:%2****** **********@TK2M SFTNGP03.phx.gb l...
DR>
>hello,
I want to create a class in a library:
public class GetHello { private string aa = "Hello world"; public GetHello() { // // TODO: Add constructor logic here // } public string GetContent() { return aa; } } Then I create a simple project and I want to use the GetContent to return the string. What I did was to add a reference to the dll created by the library class, from the Projects tab. then I create an object: MyData_Objec t myObj = new MyData_Object() ; trying to use myObj, it does not see the method I created earlier: GetContent
Thank you
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
>MyData_Objec t myObj = new MyData_Object() ;
>>
You can only create an object of a class, not a namespace.
J.W.
Daniela Roman wrote:
I forgot to mention:
namespace MyData_Object
{
}
"Daniela Roman" <da**********@r ogers.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>hello,
I want to create a class in a library:
public class GetHello { private string aa = "Hello world"; public GetHello() { // // TODO: Add constructor logic here // } public string GetContent() { return aa; } }
Then I create a simple project and I want to use the GetContent to return the string. What I did was to add a reference to the dll created by the library class, from the Projects tab. then I create an object: MyData_Objec t myObj = new MyData_Object() ;
>trying to use myObj, it does not see the method I created earlier: GetContent
Thank you
Thanks
I got the problem, I need to use the namespace in the USING reference and
then the class will be seen entirely.
Is this the approach in N-tier architecture? I mean to create each layer in
a library and then make references to them?
Thank you
What you need to do is to include the *Project* for the class library in the
Solution for any application that wants to use it. You can include a project
in as many Solutions as you like. I have a single class library Project that
is included in every Solution that I have written. After including the
Project in the Solution, create a reference to the *Project* in the other
Project. Visual Studio will manage the rest.
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Shooter http://unclechutney.blogspot.com
A man, a plan, a canal, a palindrome that has.. oh, never mind.
"Daniela Roman" <da**********@r ogers.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
hello,
I want to create a class in a library:
public class GetHello
{
private string aa = "Hello world";
public GetHello()
{
//
// TODO: Add constructor logic here
//
}
public string GetContent()
{
return aa;
}
}
Then I create a simple project and I want to use the GetContent to return
the string.
What I did was to add a reference to the dll created by the library
class, from the Projects tab.
then I create an object:
MyData_Object myObj = new MyData_Object() ;
trying to use myObj, it does not see the method I created earlier:
GetContent
Thank you
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Edward Diener |
last post by:
This has occurred in MC++, but since there is very little response on that
NG, I am also reporting it here in the hope that someone can find me a
workaround, and report it to MS.
If a __value class with an event is put into an assembly and a __gc class in
another assembly, which has an instance of the __value class as a data
member,...
|
by: keith |
last post by:
I created a custom control class which inherted from
another control class in C#. The another control
referenced another assembly.
I put the custom control into toolbox and drew it into
a form in .NET window app in C#.
When compiled the window app, I got error that said
I needed to reference an assembly referenced in the base
class.
|
by: glenn |
last post by:
I am assuming that Microsoft has renamed their (dll's) and are now calling
them class libraries since I can't find anything related to dll's in Visual
Studio. If I am correct in this assumption then can anyone help me with how
to have my class library display a MessageBox.Show. I can't seem to add the
proper using statement to get access to...
|
by: Lee Franke |
last post by:
I can't seem to figure this one out.
Here is my class structure
namespace name
{
public class foo
{
}
}
|
by: Edward Diener |
last post by:
If a __value class with an event is put into an assembly, and a __gc class
in another assembly attempts to attach its own event handler to the __value
class's event of an embedded object of the __value class type, everything
compiles correctly but the Linker puts out error "LINK : error LNK2020:
unresolved token (0A000003) AValueClassEvent"...
| |
by: Dave |
last post by:
We have developed a few .NET components. The application access these
components through well defined interface IOurInterface.
The application list display name of each component in the dialog, so
user can choose which one he wants to use. To display list of available
components we have to associate human redable display name with each...
|
by: Nonee |
last post by:
Anyone, anyone? : )
Hello-
I have a form with the mediaplayer referenced to play mp3's and avi's
and I believe that is what is causing the problem. I am not sure, but
I am hoping. Anyway, I "published" the vb.net app and moved it to
another computer and I get the following error msg when I load the
form with the mediaplayer on it. ...
|
by: Peter Gummer |
last post by:
This is a design question.
I have a project containing a dozen or so classes with protected
internal constructors.
My reason for having protected internal constructors is to prevent
classes in other assemblies from instantiating them. There is a factory
class that instantiates them. Only the factory should do so, because
some of these...
|
by: tony |
last post by:
Hello!
I'm trying to build a class library which has a class called
AvestaPlantFunc.
In this project building a class libray exist a class called
AvestaPlantFunc. In this class is there a method called IsBottomMixValid.
Code not relevant for the question has been removed.
This method IsBottomMixValid has one parameter and the type for this...
|
by: nadeem_far |
last post by:
Hello All,
I have a couple of questions and I am not able to find them any where
on internet.
1. We are using a third party class library which exposes a class with
the name of "class".
Now how can i create an object of this "class" class as class is a
reserve word in C#.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |