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 / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

Forms in Class Libraries - Beginners Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roger Stenson - 03 Dec 2004 00:41 GMT
Hi
I am just beginning learning Dot Net, though I am a fairly experienced VB6
traditional developer.

I have a Solution which contains of libraries of classes which I want to
reuse widely in multiple projects , including some forms which I want to
inherit. These forms need to  show the output of the back -office classes
often using 'MessageBox.Show.

Because the form is stored in a class library it seems to have lost some
function including MessageBox. Is there a simple way round this by importing
the right namespace or is this a no-no for Windows forms stored in Class
Libraries

Roger Stenson
Tom Krueger [MSFT] - 03 Dec 2004 00:56 GMT
Hello,

To show a MessageBox or a Form from a class library you will need to add a
reference to System.Windows.Forms.  The MessageBox is in the
System.Windows.Forms namespace.  If you are using it from a class you will
need to use/import the name space or write it out completely like
System.Windows.Forms.MessageBox.Show("Hello World");

In your main application you will need to add a reference to the class
library.

Hope that helps,

Tom Krueger

Smart Client DevCenter - http://msdn.microsoft.com/smartclient/
Mobile DevCenter - http://msdn.microsoft.com/mobility

This posting is provided "as is" with no warranties and confers no rights.

> Hi
> I am just beginning learning Dot Net, though I am a fairly experienced VB6
[quoted text clipped - 11 lines]
>
> Roger Stenson
Roger Stenson - 03 Dec 2004 20:37 GMT
Hi Tom

Thanks enormously for your help with my beginners problems.

I imagined MessageBox came from System.Windows.Forms.Form as I don't recall
importing System.Windows.Forms as well as inheriting the 'form' when
developing an ordinary forms application.

Anyway you have solved the problem and thanks

Roger Stenson

> Hello,
>
[quoted text clipped - 31 lines]
>>
>> Roger Stenson

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.