Results 1 to 5 of 5

Thread: Messagebox and Custom Class Library

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2002
    Location
    Newcastle, Australia
    Posts
    42

    Messagebox and Custom Class Library

    Hi,

    I am writing a custom control to accept date values only.

    I wish to display an error message if an incorrect date is entered, however when I use the Messagebox.Show() command the dll will not compile.

    The error message is "Name 'Messagebox' is not declared."

    Either this is not possible, or I have to import a system reference of some kind into my project.

    Can someone assist?

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    You have to set a reference to the System.Windows.Forms assembly.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2002
    Location
    Newcastle, Australia
    Posts
    42
    Hi,

    I had already done what you suggested when I started the project.

    Project ->Add Reference -> .Net Tab

    System.Windows.Forms.dll

    Is his correct/what you mean?

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Yes, you may also want to import the namespace to alleviate having to use the fully qualified name when referencing types in the namespace.

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2002
    Location
    Newcastle, Australia
    Posts
    42
    ahh, thats better!.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width