16. MDI Application Forms The main form is the parent and the smaller forms are the child forms
17.
18.
19. Child Form Code Example Private Sub displayChildOneMenuItem_Click(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _ displayChildOneMenuItem.Click ' Display Child One form. Dim childOneForm As New childOneForm( ) childOneForm.MdiParent = Me childOneForm.Show( ) End Sub
20. MDI Child Title Bar Example ' Module-level declarations. Dim childOneCountInteger As Integer Private Sub displayChildOneMenuItem_Click(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _ displayChildOneMenuItem.Click ' Display Child One form. Dim childOneForm As New childOneForm childOneForm.MdiParent = Me childOneCountInteger += 1 childOneForm.Text = "ChildOne Document " _ & childOneCountInteger.ToString( ) childOneForm.Show( ) End Sub
21.
22.
23. MenuStrip Control (2 of 2) Set the MdiWindowListItem property to make the Window menu display the list of open MDI child windows
Brief description on how to navigate within this presentation (ppt) The first time a Key Term from the chapter is used in the ppt it will display in blue Gold colored text boxes display coding examples Slides will be numbered (# of #) when multiple slides on same topic (Slide title) Speaker notes are included where appropriate for slides (*)Denotes either a comment for page reference to textbook or slide reference in ppt
*The next slide displays the SetError Method (key term) General Form and example
If a form has many input fields, the validation code can be quite long and complex Users can become confused or annoyed if multiple message boxes appear one after another
In the Validating event procedure error checking can be performed and a message displayed for the user If the validating event is used on the field that receives focus when the form is first displayed and rquires an entry, the user will be unable to close the form without filling in the text box—the e.Canel = False
If the user enters invalid data for the mask, such as a letter for a numeric month in the date mask, the character is not accepted
The structure for loops, exception handling, and arrays are found under the Visual Basic Language option
4
VB allows users to have forms that act independently from each other as well as having forms that may have a parent form and several child forms A feature of MDI is that several documents can be open at the same time-the menu strip generally contains a Window menu that allows a list of open windows to display and move from active document to another
5 Any form can be a parent-a form can be both a parent and a child form
*The next slide shows an example of a Child form
With multiple child windows, the title bar of each child window should be unique—this can be accomplished by appending a number to the title bar before displaying the form
Take a look at the Window menu in an application such as Word or Excel-a list of the open documents as well as options for arranging the windows displays
*The next slide displays the code to layout several child windows that are open
Adding features such as toolbars and/or status bars can enhance the usability of a program Toolbars are typically used in applications as an easy shortcut for menu items Status bars normally appear at the bottom of the screen to display information for the user *The next slide displays the ToolStrip’s Items Collection Editor
Select an items property in the Properties window to open the ItemsCollection Editor
*The next slide displays code examples for assign value to ToolStripStatusLabels
*The next slide provides additional details for the DateTimePicker control Value property
The DateTime Picker drops down a calendar when selected and shows the selected day and date when not dropped down; the MonthCalendar control displays the calendar
User enters a birthdate in a text box-it converts the text box entry in a Try/Catch in order to trap for illegal date formats
Be sure to have a live internet connection to display Web pages in the WebBrowser control
Notice the use of “Uri” in the above table. A Uniform Resource Identifier (URI) is a Web address that is more generic than “URL”. The latest version of the WebBrowser control requires that all URL’s be instances of the Uri class.
This slide displays a Web page in a WebBrowser control-the form has a ToolStrip control with a ToolStripComboBox and a ToolStripButton to aid navigation When the user enters a new URL in the text portion of the combo box, he or she can either press Enter or click the Go button on the toolbar The ToolStripComboBox_KeyUp event procedure checks for the Enter key, and the ToolStripButton_Click event procedure checks for a click on the button