65.9K
CodeProject is changing. Read more.
Home

DialogBoxes

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.11/5 (8 votes)

Nov 1, 2006

viewsIcon

32462

downloadIcon

355

Frequently used Dialog Boxes

Introduction

This article is a demonstration of the usage of three types of most frequently used dialog boxes. The first One is the Input Box. This One is very usefull in C#.net because, I think there is no sunch a thing in it. Its is as same as the one VB. Its has four overloading methods The Second one is the Combo Input Box. Which is slightly modified from The Input Box. Here we populate the Combo Box by passing a string array and select or enter a new value. The Third is the Change Password Dialog Box. Here we pass the current password and validate it with the new password and confirm password and get the new password on OK.

The Code

First Add the Dialog Boxs.dll file into refrence.
 using DialogBoxs; 
Input Text Box
TextInputBox ObjTextInputBox= new TextInputBox();
            if( ObjTextInputBox.Show("Enter the Value",this.Text) == DialogResult.OK)
                MessageBox.Show("The Entered Value : "+ObjTextInputBox.Text);
Input Combo Box

ComboInputBox ObjComboBox = new ComboInputBox();
            string[] Names=new string[10];
            Names[0]="India";
            Names[1]="USA";
            Names[2]="UK";
            Names[3]="RUSSIA";
            Names[4]="Bulgaria";
            Names[5]="Singapore";
            Names[6]="Malayasia";
            Names[7]="Japan";
            Names[8]="Thailand";
            if(ObjComboBox.Show("Select or Enter the Country",this.Text,Names) == DialogResult.OK)
                MessageBox.Show("The Selected or Entered Country : "+ObjComboBox.Text);
Change Password
ChangePasswordDialogBox ObjChangePasswordDialogBox= new ChangePasswordDialogBox();
            if (ObjChangePasswordDialogBox.Show("Enter the Details to Change Password",this.Text,"123456")==DialogResult.OK)
                MessageBox.Show("New Password : " +ObjChangePasswordDialogBox.NewPassword);
Sample image

Summary

This is a simple project.The Main Intension of this project is make C#.net as easy as Vb.net, as the early contains a Input Box with less features. Please do give any ideas or any requirments which are frequently need in the projects.