8.4. Dialog boxes
Windows forms can act as dialog boxes that are used to interact with users and retrieve information. To construct our own dialog box we create a new form, and set its FormBorderStyle property to FixedDialog or FixedToolWindow – this automatically removes unnecessary minimize, maximize, and system menu buttons. After this, we place the necessary controls and buttons on the form. Usually, we have Ok, Cancel, or Abort buttons in the dialog box. By associating the DialogResult property of each button with the appropriate DialogResult value, such as Ok, Cancel, and so on, we can specify the resulting action of the dialog box. This allows us to let the calling code know how it was closed.
Dialog boxes can be displayed either modally ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access