Solved

MessageBox.show from class library

Posted on 2004-10-27
336 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
Question by:brdrok
    4 Comments
     
    LVL 9

    Accepted Solution

    by:
    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_
    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
    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
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    877 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

    12 Experts available now in Live!

    Get 1:1 Help Now