C# Language How to use own created MessageBox control in another Windows Form application.


To find your existing .cs files, right click on the project in your instance of Visual Studio, and click Open Folder in File Explorer.

  1. Visual Studio --> Your current project (Windows Form) --> Solution Explorer --> Project Name --> Right Click --> Add --> Existing Item --> Then locate your existing .cs file.

  2. Now there's one last thing to do in order to use the control. Add a using statement to your code, so that your assembly knows about its dependencies.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using CustomMsgBox; //Here's the using statement for our dependency.
  3. To display the messagebox, simply use the following...

    CustomMsgBox.Show("Your Message for Message Box...","MSG","OK");