Click here to Skip to main content
15,896,063 members
Articles / Programming Languages / C#

XmlStore Part 2: Printing DataGridView Contents

Rate me:
Please Sign up or sign in to vote.
4.71/5 (7 votes)
18 Mar 2007CPOL7 min read 70K   3.4K   51  
A utility to read, edit, encrypt, decrypt, write and print XmlStore files
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace VVX
{
    /// <summary>
    /// Simple class to simplify access to MessageBoxes of different kinds
    /// WARNING: By no means complete!!!
    /// </summary>
    public static class MsgBox
    {
        //---------------------------------------------------------------------
        /// <summary>
        /// Displays a Confirm type message box
        /// </summary>
        /// <param name="sMsg">The message you want to display</param>
        public static bool Confirm(string sMsg)
        {
            return Confirm("Confirm", sMsg);
        }
        public static bool Confirm(string sTitle, string sMsg)
        {
            DialogResult ret = MessageBox.Show(sMsg, sTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            return (ret == DialogResult.Yes);
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Displays a Error type message box
        /// </summary>
        /// <param name="sMsg">The message you want to display</param>
        public static void Error(string sMsg)
        {
            Error("Error", sMsg);
        }
        public static void Error(string sTitle, string sMsg)
        {
            MessageBox.Show(sMsg, sTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }


        //---------------------------------------------------------------------
        /// <summary>
        /// Displays a Warning type message box
        /// </summary>
        /// <param name="sMsg">The message you want to display</param>
        public static void Warning(string sMsg)
        {
            Warning("", sMsg);
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Displays a Warning type message box
        /// </summary>
        /// <param name="sCaption">Name of Application or Class or Method</param>
        /// <param name="sMsg">The message you want to display</param>
        public static void Warning(string sCaption, string sMsg)
        {
            if (sCaption.Length == 0)
                sCaption = "Warning";
            MessageBox.Show(sMsg, sCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }


        //---------------------------------------------------------------------
        /// <summary>
        /// Displays a Information type message box
        /// </summary>
        /// <param name="sMsg">The message you want to display</param>
        public static void Info(string sMsg)
        {
            Info("", sMsg);
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Displays a Information type message box
        /// </summary>
        /// <param name="sCaption">Name of Application or Class or Method</param>
        /// <param name="sMsg">The message you want to display</param>
        public static void Info(string sCaption, string sMsg)
        {
            if (sCaption.Length == 0)
                sCaption = "Information";
            MessageBox.Show(sMsg, sCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
An old dog trying to learn new tricks!

Comments and Discussions