Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MessageBox.show from class library

Posted on 2004-10-27
4
Medium Priority
?
366 Views
Last Modified: 2008-02-26
Hello experts,

currently in the process of attempting to write a class library.  what I am wondering is whether it's bad practice to incorporate the "System.Windows.Forms" namespace so I can get a messagebox to show in the event that there is an error.

thanks

0
Comment
Question by:brdrok
[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
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
tinchos earned 100 total points
ID: 12426946
It all depends on the purpose of your library.

If your library handles the user interface then I wouldn't consider it too wrong.

If it is a low level service class library, I would rather throw an exception or return an error code which would be processed in my app and depending on the returned value I would show a message box.

Hope this helps
Tincho

0
 
LVL 8

Assisted Solution

by:Razzie_
Razzie_ earned 100 total points
ID: 12428324
I don't see any reason why you would want to use a messagebox in a library. A library can *never* run as a standalone application. So there'd be no point in using a messagebox. I'd really return an error code or throw an exception and let the encapsulating application handle any possible UI components.

Cheers,

Razzie
0
 
LVL 7

Author Comment

by:brdrok
ID: 12432805
Heya,  

based on those two answers, I guess I'll stay away from messageBoxes.  Figured as much, but better to measure twice and cut once :)

0
 
LVL 7

Author Comment

by:brdrok
ID: 12432818
Forgot to mention, if you two know anything about sound C# designs and database designs, I will post a new question in a few minutes.  

thanks

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

610 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