Skip to main content

CsharpForBeginers 02 - Showing MessageBoxes

Hi guyz ...
This is the second part of MessageBoxes Tutorial. In this tutorial we are going to talking about how to create Yes/No message Box.

MessageBoxButtons

  • Go to the UI and double click on the Button.Then remove the all codes within the curly braces.
  • Add following codes within the braces


Code:
MessageBox.Show("Will you really remove the item?", 
"Warning", MessageBoxButtons.YesNo);







  • So the final code should be like this  

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Will you really remove the item?", "Warning", MessageBoxButtons.YesNo);
        }
    }
}


  • OK guyz itz time to run the program .. You will get output like this 

  •  Guyz you can try more message-boxes like 
OK
OK/Cancel
Retry/Cancel
Yes/NO/Cancel
Abort/Retry/Cancel
  • Just type "MessageBoxButtons." within the braces then VS will automatically suggest above list try it.....

Thank You

Comments

Popular posts from this blog

Load an Addin into DraftSight

These days i am developing two plugins for Autocad 2012 &  DraftSight 2013.so when i was developing the plugin i got in to big trouble.Normally in the Autocad , we can load the .dll file simply typing the command "NETLOAD" but in the Draftsight i could not able to do that. It said  " D:\c \projects\c projects\DSAddinCSharp1\ DSAddinCSharp1\bin\Debug\ DSAddinCSharp1.dll is not a valid add-in "

C# Character Escape Sequences

Character combinations consisting of a backslash ( \ ) followed by a letter or by a combination of digits are called "escape sequences." To represent a newline character, single quotation mark, or certain other characters in a character constant, you must use escape sequences. An escape sequence is regarded as a single character and is therefore valid as a character constant.

Imagine Cup 2014

Hi guys .. Get ready for imagine cup 2014 In NewZealand .In the next few days imagine cup 2013 finals will happen in Russia. So It is time to wear your thinking hat.You have one year to develop your marvelous ideas.  The Microsoft Imagine Cup is the world’s most prestigious student technology competition, bringing together student innovators from all over the world. If you have a great idea for a new app, bring it to life through Imagine Cup. Over the past 10 years, more than 1.65 million students from 190 countries have participated in the Imagine Cup.