1 All Powder Board and Ski SQL Server Workbook Chapter 6: Forms, Reports, and Applications Jerry Post Copyright © 2003.

Slides:



Advertisements
Similar presentations
1 All Powder Board and Ski Microsoft Access Workbook Chapter 8: Applications Jerry Post Copyright © 2007.
Advertisements

1 All Powder Board and Ski Microsoft Access Workbook Chapter 6: Forms and Reports Jerry Post Copyright © 2007.
Chapter 3 – Web Design Tables & Page Layout
Microsoft Word By: Phuong Nguyen.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Using Macros and Visual Basic for Applications (VBA) with Excel
XP New Perspectives on Microsoft Access 2002 Tutorial 61 Microsoft Access 2002 Tutorial 6 – Creating Custom Reports.
INSERT BOOK COVER 1Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast,
Microsoft Office 2010 Access Chapter 1 Creating and Using a Database.
Chapter 3 Tables and Page Layout
Microsoft Excel 2010 Chapter 7
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
FIS 318/618: Financial Systems & Databases Forms and Reports Oakland University School of Business Administration Accounting and Finance Joe Callaghan.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
Creating a Web Page HTML, FrontPage, Word, Composer.
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 4 Reports, Forms, and Combo Boxes.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Tutorial 6 Using Form Tools and Creating Custom Forms
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
® Microsoft Access 2010 Tutorial 6 Using Form Tools and Creating Custom Forms.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Excel Project 5 Creating, Sorting, and Querying a List.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 4Creating and Using Custom Forms.
CITY UNIVERSITY / Vysoká Škola Manažmentu.:IS Information Systems :. © Martina Cesalova, 2005 MS ACCESS 1 Start Microsoft Access – New - Blank Database.
Using Form Tools and Creating Custom Forms Microsoft Access 2010.
Chapter 6 Advanced Report Techniques
Creating a Web Site to Gather Data and Conduct Research.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Access 2002 Advanced Report Design.
Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin TECHNOLOGY PLUG-IN T8 DECISION MAKING USING ACCESS.
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Thirteen Working with Access Databases and LINQ.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
Key Applications Module Lesson 21 — Access Essentials
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
COMPREHENSIVE Access Tutorial 6 Using Form Tools and Creating Custom Forms.
Database Systems Microsoft Access Practical #2 Making Forms and Reports Nos 215.
Moodle with Style Integrating new technologies to empower learning and transform leadership.
1 What to do before class starts??? Download the sample database from the k: drive to the u: drive or to your flash drive. The database is named “FormBelmont.accdb”
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Access Project 7 Advanced Report and Form Techniques.
Tables Sacramento City College Engineering Design Technology.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 6: Forms, Reports, and Applications Jerry Post Copyright © 2003.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 8 BACKNEXTEND 8-1 LINKS TO OBJECTIVES Save a Workbook as a Web Page Save a Workbook as a Web.
Gold – Crystal Reports Introductory Course Cortex User Group Meeting New Orleans – 2011.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 6 BACKNEXTEND 6-1 LINKS TO OBJECTIVES Using the Report Button Using the Report Button Print.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Access 2002 Advanced Form Design.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Chapter 28. Copyright 2003, Paradigm Publishing Inc. CHAPTER 28 BACKNEXTEND 28-2 LINKS TO OBJECTIVES Table Calculations Table Properties Fields in a Table.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 7 Creating Templates, Importing Data, and Working with SmartArt, Images, and Screen Shots Microsoft Excel 2013.
Excel Chapter 1 Creating a Worksheet and an Embedded Chart
Chapter 6: Forms, Reports and Applications All Powder Board and Ski
Microsoft Access 2007 – Level 2
Building a User Interface with Forms
Chapter 7 Advanced Form Techniques
Chapter 18 Finalizing a Database.
Presentation transcript:

1 All Powder Board and Ski SQL Server Workbook Chapter 6: Forms, Reports, and Applications Jerry Post Copyright © 2003

2 Form Types StyleStyle DescriptionCategory Customer Last Name First Name Phone Address City Ski Board Style Sale CustomerSalesperson ItemIDDescriptionPriceQuantityValue Main Grid Main and Subform

3 Customer Main Form Record navigation Text box Label

4 Action Right-click the project, Add/Add New Item. Choose the Data Form Wizard. Enter the name Customer.vb Create a new connection if necessary. Move the Customer table to the right. Make sure all Columns are checked. Select option to display a single record. Fix the page layout. Add a button to the main form to open the Customer form with code. Test! If necessary, add password to the connection string.

5 Main Form Wizard Select table Add/Add New Item Data Form Wizard

6 Display Style Main form

7 Design View Properties Database connectionToolbox

8 Visual Studio Form Structure Form Dataset: Customer Order LastName FirstName OrderID OrderDate Database Data Adapter (Order) Fill/Load Update Data Adapter (Customer) Fill/Load Update

9 Action Double-click the Load button. Copy the code inside the subroutine. At the top of the code page, expand the region created by the designer. Find the New subroutine at the top. Find the comment ‘Add any initialization Paste the code after that comment. Save and test the form. Delete the Load button and its code.

10 Form Triggers Paste the code from the Load event Start button

11 Action Delete the text box for Gender. Drag a combo box from the ToolBox. Expand the Property window. Name it cboGender. Delete any entry in the Text property. In Items, enter Male, Female, Unidentified. Expand the DataBindings property. For Text and SelectedValue, expand and pick objdsCustomer – Gender. Save and test the form. Set the Tab Index for all controls.

12 Combo Box and Data Binding Combo Box Data Binding

13 Initial Grid Form

14 Action Add a new form with Add/Add New and the Data Form Wizard. Create a new dataset (dsSkiBoardStyle). Use the existing connection. Select the Grid layout. Add the password to the ConnectionString. Copy the code from the Load button to the New event. Add a new button to the Main form. Add the code to open the new form. Save everything and test the form.

15 Create the Grid Form Grid Form

16 Private Sub SetGridStyles() ' To control the grid layout and format you need a DataGridTableStyle Dim tableStyle As New DataGridTableStyle tableStyle.MappingName = "SkiBoardStyle" ' The table name ' Create a DataGridColumnStyle for each column Dim colStyle As New DataGridTextBoxColumn colStyle.MappingName = "Style" colStyle.HeaderText = "Style" colStyle.Width = 135 tableStyle.GridColumnStyles.Add(colStyle) ‘ Put the StyleDescription Column here Dim colStyleCategory As New DataGridTextBoxColumn colStyleCategory.MappingName = "Category" colStyleCategory.HeaderText = "Category" colStyleDescription.Width = 100 tableStyle.GridColumnStyles.Add(colStyleCategory) ' Add the tableStyle to the grid Me.grdSkiBoardStyle.TableStyles.Add(tableStyle) End Sub Grid Column Layouts Define the style for each column in the order you want displayed Create the style Add the style to the grid

17 Action Open the code behind the form and create a new subroutine. Copy the code from the example to create a table style and each column style. In the form’s New event under initialization, call the new subroutine. Test the code and debug it.

18 Add a Data Adapter for Lookup List SQL Data Adapter Create query Advanced options

19 Properties for Lookup Data Grid NamegrdCategory DataSourcedsProductCategory1 DataMemberProductCategory CaptionVisibleFalse ColumnHeadersVisibleFalse PreferredColumnWidth75 RowHeaderWidth0 ReadOnlyTrue LockedTrue VisibleFalse

20 Code for Lookup List: Startup #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call Try 'Attempt to load the dataset. Me.LoadDataSet() Me.SqlDataAdapter1.Fill(Me.DsProductCategory1) grdCategory.Visible = False Catch eLoad As System.Exception 'Add your error handling code here. 'Display error message, if any. System.Windows.Forms.MessageBox.Show(eLoad.Message) End Try SetGridStyles() End Sub

21 Lookup Code: Main Grid Const iColCategory = 2 ' Column for drop down list Private row As Integer Private col As Integer Private Sub grdSkiBoardStyle_CurrentCellChanged( _ ByVal sender As Object, ByVal e As System.EventArgs) _ Handles grdSkiBoardStyle.CurrentCellChanged Dim cell As DataGridCell = grdSkiBoardStyle.CurrentCell If (cell.ColumnNumber <> iColCategory) Then grdCategory.Visible = False Exit Sub ' Only care about last column End If row = grdSkiBoardStyle.CurrentRowIndex col = cell.ColumnNumber Dim rect As Rectangle = grdSkiBoardStyle.GetCellBounds(row, col) Dim tb As DataGridTextBox = grdSkiBoardStyle.Controls(2) tb.BackColor = System.Drawing.Color.Blue grdCategory.Left = rect.Left + grdSkiBoardStyle.Left grdCategory.Top = rect.Bottom + grdSkiBoardStyle.Top grdCategory.Visible = True End Sub

22 Lookup Code: Category Grid Private Sub grdCategory_Click( _ ByVal sender As Object, ByVal e As System.EventArgs) _ Handles grdCategory.Click Dim tb As DataGridTextBox = grdCategory.Controls(2) Me.objdsSkiBoardStyle.Tables("SkiBoardStyle"). _ Rows(row)(iColCategory) = tb.Text grdCategory.Visible = False End Sub

23 Action Add a SQLDataAdapter to the form. Retrieve the data from the ProductCategory table and uncheck the UPDATE option. Right-click the adapter to create a new dataset: dsProductCategory. Add a new data grid to the form and size it. Set the data grid properties. Add initialization code to load the dataset. Add subroutine to display the lookup list. Add subroutine to transfer data from the lookup list to the main dataset.

24 Grid with Lookup User clicks left of row to select.

25 Main/Subform by Sale The Data Form Wizard uses relationships to handle Parent and Child tables.

26 Action Create a new form with the Data Form Wizard. Add a new dataset with the existing connection. Choose the Sale and SaleItem tables. Create a parent child relationship with the SaleID column. Choose all columns except the SaleID in the SaleItem table. Select the single row option for the main form. Add the password to the ConnectionString. Move the Load button code to the New sub. Save and test the form.

27 Initial Form Design Sale form SaleItem grid

28 Dataset Designer to Add Column Add the Value column as an Element with the decimal data type

29 Action Open the dsSale.xsd dataset. Add an Element called Value with a decimal data type. Add the new column to the data grid with the TableStyles and GridColumnStyles properties. Name: objColumnStylegrdSaleItemValue Alignment: Right Format: 0.00 MappingName: Value ReadOnly: True Add the expression code. Call the expression code from the New subroutine.

30 Subform Value Column in Grid Open the TableStyles Open the columns Add a column Set the properties

31 Expression Code Public Sub CreateValueExpression() Dim tbl As DataTable = Me.objdsSale.Tables("SaleItem") Dim col As DataColumn = tbl.Columns("Value") col.Expression = "SalePrice*QuantitySold" End Sub Public Sub New() Try 'Attempt to load the dataset. Me.LoadDataSet() CreateValueExpression() Catch eLoad As System.Exception 'Add your error handling code here. End Try Me.objdsSale_PositionChanged() End Sub

32 Action Copy and paste the SalePrice column in the subform to create a Value column Assign properties so that it multiplies SalePrice by QuantitySold Copy and paste this new column to create a subtotal column Assign properties to make it a Summary calculation for Sum of the Value field Add subtotal and total fields to the Sale data block to display the subtotal and add the sales tax

33 Subform Subtotal Column Public Sub ComputeSaleTotal() Dim dr As DataRow Dim sum As Decimal = 0 Dim iSale As Integer = _ Me.BindingContext(objdsSale, "Sale").Position For Each dr In Me.objdsSale.Tables("Sale"). _ Rows(iSale).GetChildRows("SaleSaleItem") sum += dr("Value") Next editSubtotal.Text = sum.ToString("0.00") Dim dTax As Decimal = 0 If (Not IsNothing(editSalesTax.Text)) _ AndAlso (editSalesTax.Text.Trim <> "") _ Then dTax = CType(editSalesTax.Text, Decimal) editTotalDue.Text = (sum + dTax).ToString("0.00") End Sub

34 Calls to Compute Totals Private Sub objdsSale_PositionChanged() Me.lblNavLocation.Text = … ComputeSaleTotal() End Sub Private Sub grdSaleItem_Leave(ByVal sender As Object, _ ByVal e As System.EventArgs) _ Handles grdSaleItem.Leave ComputeSaleTotal() End Sub Private Sub editSalesTax_Leave(ByVal sender As Object, _ ByVal e As System.EventArgs) _ Handles editSalesTax.Leave ComputeSaleTotal() End Sub New Sale Leave grid Change tax

35 Action Add the routine to compute the subtotal. Add the three calls to perform the calculation. Modify the UpdateDataSource code to compensate for the Expression bug in Microsoft’s update code.

36 Code Changes for Update Bug Public Sub UpdateDataSource… if (Not (ChangedRows) Is Nothing) Then 'Open the connection. Me.OleDbConnection1.Open() 'Attempt to update the data source. OleDbDataAdapter1.Update(ChangedRows) Dim tbl As DataTable = Me.objdsSale.Tables("SaleItem") Dim exp As String = tbl.Columns("Value").Expression tbl.Columns("Value").Expression = String.Empty tbl = tbl.Copy() OleDbDataAdapter2.Update(tbl) Me.objdsSale.Tables("SaleItem").Columns("Value").Expression = exp End If Find this routine Comment this line out Insert 6 lines

37 Sale Form

38 Action Add a data adapter for CustomerList, creating a query for full name and phone. Add the fill command to the New sub. Add a combo box and assign the DataSource, DisplayMember, ValueMember and DataBindings: Selected Value. Create a similar data adapter and combo box for Payment Method.

39 Customer Query SELECT CustomerID, LastName + N', ' + FirstName + N' (' + Phone + N')' AS CustomerName FROM powder.Customer ORDER BY LastName, FirstName, Phone Combo Boxes only support two columns: Key Value and Display Remember to deselect the Advanced options to Insert/Delete/Update

40 Customer Combo Box Properties Dataset Display column Key column Bind to Form Be sure to add the Fill command in the New subroutine

41 Action Add a data adapter for the Item List lookup using the Inventory and Item tables. Create the dataset and add the fill command in the New sub. Add the data grid for the lookup list and set its properties. Add a new TableStyles entry and create entries for the ColumnStyles to set the display widths. Add the two sets of code to open the lookup list and transfer the selection to the dataset.

42 Code for SubGrid Lookup List Const iColCategory = 0 ' Column for drop down list Private row As Integer Private col As Integer Private Sub grdSaleItem_CurrentCellChanged( _ ByVal sender As Object, ByVal e As System.EventArgs) _ Handles grdSaleItem.CurrentCellChanged Dim cell As DataGridCell = grdSaleItem.CurrentCell If (cell.ColumnNumber <> iColCategory) Then grdItems.Visible = False Exit Sub ' Only care about last column End If row = grdSaleItem.CurrentRowIndex col = cell.ColumnNumber Dim rect As Rectangle = grdSaleItem.GetCellBounds(row, col) Dim tb As DataGridTextBox = grdSaleItem.Controls(2) tb.BackColor = System.Drawing.Color.Blue grdItems.Left = rect.Left + grdSaleItem.Left grdItems.Top = rect.Bottom + grdSaleItem.Top grdItems.Visible = True End Sub

43 Code for Data Transfer List Private Sub grdItems_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles grdItems.Click Dim tb As DataGridTextBox = grdItems.Controls(2) ' The next line index must be +1 because the ‘ subform grid has SaleID as a hidden column #0 Me.objdsSale.Tables("SaleItem"). Rows(row)(iColCategory + 1) = tb.Text grdItems.Visible = False End Sub This is the main difference when using a subform

44 Final Sale Form

45 SQL Server Report Structure Page header Page footer Body Customer Group Customer header Sale GroupSale header Item Detail Customer footer Sale footer

46 Action Create a new report project with SQL Reports Service. Add a new Shared Data Source to the Powder database. Add a new report—without using the Wizard. Create a query using Customer + Sale + SaleItem. Add the alias: QuantitySold*SalePrice As Value. In the layout tab, add a Report Header and a title test box. Drag a List box onto the report. Name: GroupCustomer. Grouping: =Fields!CustomerID.Value Drag customer fields onto the List and add labels. Preview the report.

47 Customer Sales Report Query Query Designer Right-click to add tables Create a new dataset Shared Data Source New report

48 Query: Calculated Value Column SELECT Customer.CustomerID, Customer.LastName, Customer.FirstName, Customer.Phone, Customer. , Sale.SaleID, Sale.SaleDate, Sale.ShipCity, Sale.ShipState, Sale.PaymentMethod, SaleItem.SKU, SaleItem.QuantitySold, SaleItem.SalePrice, SaleItem.QuantitySold * SaleItem.SalePrice AS Value FROM Customer INNER JOIN Sale ON Customer.CustomerID = Sale.CustomerID INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID ORDER BY Customer.CustomerID, Sale.SaleDate, SaleItem.SKU

49 Customer List Layout Toolbox or Fields List for Customer group Customer Fields/data Text box label Report headerLayout tab

50 Initial Preview Report header Data for one customer

51 Action Add a list for the Sale Group. Set Grouping: =Fields!SaleID.Value. Place Sale header items into list. Add a small list for SaleItem as the Detail, with no Grouping. Add the SaleItem boxes to Detail. Format Price and Value to Add column heading text boxes in the Sale group, above the Detail list. Preview the report, clean up the layout, add separator lines.

52 Sales and SaleItem Groups Detail list has no Grouping property Column headings in GroupSale list Lines as separators

53 SaleItem Preview Customer header Sale header Detail Format: 0.00

54 Action Adjust the Customer and Sale list boxes to leave one row at the bottom of each. Drag the Value field into those spaces. Align it with the SaleItem Value to show the total. Set the format to $ #,##0.00. Add a Page Footer: Report/Footer. Add a text box and use an Expression to enter =Globals!PageNumber. Preview and adjust the report.

55 Final Layout Sale Footer Customer Footer Expression builder for page number Customer list Sale list

56 Final Report

57 Creating a Switchboard Form Add image with PictureBox Open forms and submenus with buttons Add report link with LinkLabel

58 Action Add an image or logo to the menu form (try clip art). Arrange the form buttons. Add a LinkLabel to open a report. Add the VisitLink subroutine to your code. Enter the code to call the VisitLink with the appropriate URL to open the desired form. Compile and test the links.

59 Open SQL Reports from Forms Sub VisitLink(ByVal lnk As LinkLabel, ByVal sURL As String) ' Change the color of the link text lnk.LinkVisited = True ' Call the Process.Start method to open the default browser System.Diagnostics.Process.Start(sURL) End Sub Private Sub lnkCustomerSalesReport_LinkClicked( _ ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) _ Handles lnkCustomerSalesReport.LinkClicked Try VisitLink(sender, _ " Catch ex As Exception MessageBox.Show("Unable to open the report.") End Try End Sub

60 Action In the object navigator create a new entry in the Menus section and rename it (CustomerMenu) In the newly created Menus subsection, create a new entry and rename it Customers In the object navigator, in the same Menus sublist, add a new item and rename it CustomerSub Double click the icon to open the Menu Editor Add entries for AAMain, Customers, Close, and Help

61 Creating Menus Enter top-level options Add menu Right-click options Sub menu Rename each item

62 Action Drag a MainMenu onto the menu form. Add top-level links for at least Customers, Close, and Help. Under Customers, add the Customer and Sale forms, and the two reports. Rename each menu item. Double-click the Customer and Sale entries and add the code to open the forms. Add the code to open the two reports. Save, compile, and test everything.

63 Custom Menu Me.Close System.Diagnostics.Process.Start(sURL)

64 HTML Help Form Help File AllPowder.chm HTML Topic Properties: Help File: AllPowder.chm Help Context ID: 1 1 Topic A 2 Topic B 3 Topic C 4 Topic D 5 Topic E 6 Topic F compile

65 Action Create at least three HTML help files for the All Powder forms using an HTML editor or Wordpad. If necessary, download and install the HTML Help workshop. Create a new project in the workshop. Add the HTML files. Edit the HTML files to add keywords. Create the mapping file with a text editor and add it to the project. Set project options to build the TOC and index files. Compile and test the help file.

66 HTML Help Files <Object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e"> All Powder Board and Ski Shop Introduction to the All Powder Board and Ski Shop All Powder Board and Ski Shop sells and rents snowboards and skis for all levels of riders and skiers. The Board and Ski Shop Customers Sales

67 Topics Map File #define AllPowder100 #define Customers10000 #define Sales20000 Not required for SQL Server, but create it anyway so that you can use the same help file with other applications if necessary.

68 Help Compiler and File

69 Action Add a HelpProvider object to the main form. Set its HelpNamespace property to AllPowder.chm. Select the Form object, set the HelpNavigator property to TableOfContents For the Customer button, set the HelpKeyword to Customer and HelpNavigator to KeywordIndex. Write the code for the Help menu item. Compile and test everything.

70 Help File on Visual Basic Form HelpKeyword: Customer Keyword Index HelpProvider HelpNamespace: AllPowder.chm

71 Help Menu Code Private Sub mnuHelp_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles mnuHelp.Click ' Tell the Help system to open the Table of Contents Help.ShowHelp(Me.btnCustomer, "AllPowder.chm", _ HelpNavigator.TableOfContents, 0) End Sub Could also use HelpNavigator.KeywordIndex, “MainMenu”

72 Help In Action