Dialogs and the Main Menu - PowerPoint PPT Presentation

About This Presentation
Title:

Dialogs and the Main Menu

Description:

Dialogs and the Main Menu A Simple Message Box Just pops up a message with an ok button MessageBox.Show( – PowerPoint PPT presentation

Number of Views:110
Avg rating:3.0/5.0
Slides: 7
Provided by: Stephe657
Category:
Tags: dialog | dialogs | main | menu

less

Transcript and Presenter's Notes

Title: Dialogs and the Main Menu


1
Dialogs and the Main Menu
2
A Simple Message Box
  • Just pops up a message with an ok button
  • MessageBox.Show("Alarm Time Reached","Alert")

3
Confirm Dialog
  • Contains both Yes and No buttons.
  • MessageBoxButtons buttons MessageBoxButtons.YesN
    o
  • DialogResult result
  • result MessageBox.Show ( this,
  • "Really Remove Alarm?", "confirm",
  • buttons)
  • if(result DialogResult.Yes)
  • // do something

4
File Selection Dialog
  • private void btnFile_Click(object sender,
    System.EventArgs e)
  • OpenFileDialog filedialog new
    OpenFileDialog()
  • filedialog.Title "Find Your File"
    filedialog.InitialDirectory _at_"c\"
    filedialog.Filter "All files (.).All
    files (.)." filedialog.FilterIndex 2
    filedialog.RestoreDirectory true
    if(filedialog.ShowDialog()
    DialogResult.OK) do something with
    filedialog.FileName

5
Custom Dialog Forms
  • Add the new form
  • project --gt add windows form
  • Design it
  • Add code for ok and cancel buttons
  • this.Hide()
  • Add code in main form to popup new form
  • AddForm tempform new AddForm()
  • tempform.Show()

6
Adding a MainMenu
Write a Comment
User Comments (0)
About PowerShow.com