Saturday, 3 August 2013

DialogBox controls...

it contains five types...

  1. colordialog
  2. fontdialog
  3. opendialog
  4. savedialog
  5. folderbrowserdialog

take 5 button 1 label and 1 textbox name them like this

take all the 5 dialog controls from the toolbox which present below the design window


COLORDIALOG:-double click on choose color button and write the code

run the project when you click on the button you will get this window.

select the color  and click on OK .
output:-color of label 1 changes to green.

FONTDIALOG:-double click on the button write the code.

run the project when you click on the button you will get this window.

select the required font and size then click on OK.
so the changes in the font visible in the textbox1
SAVEFILE:-in the button write the code

when you double click on the save file dialog control present below in the design window you will get the method and write the code in this.whatever you write in the textbox it save as a txt format..
clickon savefile button after writing in the textbox.you will get


name the file a.txt or whatever you want with a .txt extension and click on save.
you will get the .txt file on your desktop open the file you will get the output..


OPENDIALOG:-you want to open the saved file.
write the code in the button
 run the project click on open button you will get the window.

the file you saved before "a.txt" select it click on the open button.
you will get the output in the textbox.
make any changes click on save button .your changes will be save.

FOLDERBROWSER:-to browse the folder and count the number of files present in the folder.
write the code in the button
run the project click on the folderbrowser button in which you write the code you will get this window
click on OK
output;-




No comments :

Post a Comment