Monday, July 6, 2015

25. VB.Net - Dialog Boxes

 VB.Net Programming Tutorial

There are many built-in dialog boxes to be used in Windows forms for various tasks like opening and saving files, printing a page, providing choices for colors, fonts, page setup, etc., to the user of an application. These built-in dialog boxes reduce the developer's time and workload.
All of these dialog box control classes inherit from the CommonDialog class and override the RunDialog() function of the base class to create the specific dialog box.
The RunDialog() function is automatically invoked when a user of a dialog box calls its ShowDialog() function.
The ShowDialog method is used to display all the dialog box controls at run-time. It returns a value of the type of DialogResult enumeration. The values of DialogResult enumeration are:
  • Abort - returns DialogResult.Abort value, when user clicks an Abort button.
  • Cancel- returns DialogResult.Cancel, when user clicks a Cancel button.
  • Ignore - returns DialogResult.Ignore, when user clicks an Ignore button.
  • No - returns DialogResult.No, when user clicks a No button.
  • None - returns nothing and the dialog box continues running.
  • OK - returns DialogResult.OK, when user clicks an OK button
  • Retry - returns DialogResult.Retry , when user clicks an Retry button
  • Yes - returns DialogResult.Yes, when user clicks an Yes button
The following diagram shows the common dialog class inheritance:
VB.Net Dialog Boxes All these above-mentioned classes have corresponding controls that could be added from the Toolbox during design time. You can include relevant functionality of these classes to your application, either by instantiating the class programmatically or by using relevant controls.
When you double click any of the dialog controls in the toolbox or drag the control onto the form, it appears in the Component tray at the bottom of the Windows Forms Designer, they do not directly show up on the form.
The following table lists the commonly used dialog box controls. Click the following links to check their detail:
S.N. Control & Description
1 ColorDialog
It represents a common dialog box that displays available colors along with controls that enable the user to define custom colors.
2 FontDialog
It prompts the user to choose a font from among those installed on the local computer and lets the user select the font, font size, and color.
3 OpenFileDialog
It prompts the user to open a file and allows the user to select a file to open.
4 SaveFileDialog
It prompts the user to select a location for saving a file and allows the user to specify the name of the file to save data.
5 PrintDialog
It lets the user to print documents by selecting a printer and choosing which sections of the document to print from a Windows Forms application.

0 comments:

Post a Comment

 
Designed by Kakada Akkarak Surakkiat
Technology: របៀប​ដំឡើង Windows 10 នៅ​លើ​កុំព្យូទ័រ!: អ្នកត្រូវដឹងឲ្យ ច្បាស់ពី Windows ដែលអ្នកយក ទៅដំឡើង ដោយសារមាន Windows ខ្លះមានការ crack រួច ឬខ្លះត្រូវការ Product key ភ្លាម និងខ្លះទៀត អាចត្រូវ skip កន្លែងវាយលេខ Product key បាន តែត្រូវ Activate តាមក្រោយ ទើបប្រើប្រាស់បាន។ Technology: ដំណោះ​ស្រាយ Error 80240020 នៅ​ពេល​តម្លើង Windows 10 Free តាម​រយៈ​ការ Upgrade : មាន បញ្ហាមួយចំនួន ទាក់ទងនឹង ការតម្លើង Windows 10 នេះផងដែរ ប៉ុន្តែបញ្ហានោះ កើតឡើង ទៅលើតែកុំព្យូទ័រ មួយចំនួនប៉ុណ្ណោះ គឺខណៈពេល ដែលអ្នក ប្រើប្រាស់ បានទាញយក Windows 10 ចប់ហើយ វាបាន បង្ហាញនូវ ផ្ទាំង error មួយ ដែលមានលេខ សំគាល់ error នោះគឺ 80240020។ ដូចនេះដើម្បី ដោះស្រាយ នូវបញ្ហា មួយនេះ សូមលោកអ្នក តាមដានអាន ជាមួយយើងខ្ញុំ ទាំងអស់គ្នា !!