Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / June 2005

Tip: Looking for answers? Try searching our database.

Getting Components to work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Butlin - 13 Jun 2005 15:06 GMT
Hi

I am fairly new to visual studio .net and after setting up a couple of
applications I have decided to introduce a library of components that I can
use for future projects
I have set up a simple component thats was shown as an example in a book .
---------------------------------------------------------------------------------
Public Class hello
   Inherits System.ComponentModel.Component
   component designer generated code

  Public Function sayhello() As String
       Return "hello !!"
   End Function
End Clas
-----------------------------------------------------------------------------------------------
This compiles ok.

In another project i try to access this component and although the project
knows about the hello function I get an error when i try to refer to
hello.sayhello
the message i get is " Reference to a non-shared member requires an object
reference".

Label1.Text = Library1.hello.sayhello  

The .dll associated with the component is stored in the same location as the
project.

Many thanks if anyone can give me any inspiration

Peter
Kevin Spencer - 13 Jun 2005 15:58 GMT
A class is not an instance of a class. You create an instance by using the
New operator. Otherwise, you must create a Shared member in order to use the
member without an instance of the class.

Signature

HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

> Hi
>
[quoted text clipped - 31 lines]
>
> Peter

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.