Address Book Navigation Buttons

The Address Book application displays the navigation buttons at the bottom of the Web page. You can use the navigation buttons to navigate around the data in the grid display, by selecting either the first or last row of data, or rows adjacent to the current selection.

The following code defines the navigation buttons. These HTML statements appear before the VBScript section of the program.

<INPUT TYPE=BUTTON NAME="First" 		VALUE="First">
<INPUT TYPE=BUTTON NAME="Prev" 		VALUE="Previous">
<INPUT TYPE=BUTTON NAME="Next"		VALUE="Next">
<INPUT TYPE=BUTTON NAME="Last"		VALUE="Last">

HTML uses the INPUT tag to define a form element, such as a button, option button, check box, or text. You use the TYPE parameter to specify the type of form element, which in this case is a button. The NAME parameter defines what the button will be called in code. The VALUE parameter specifies the labels associated with the button (First, Previous, Next, and Last) that are displayed on the page.

When a user clicks a button, an event is generated, and VBScript activates the appropriate navigation Sub procedure.

Navigation Sub Procedures

The Address Book application contains several procedures that allow users to click the First, Next, Previous, and Last buttons to move around the data. To enable movement, you can specify the method of the AdvancedDataControl object (SControl) to the type of movement you want. The method differs for each navigation button.

For example, clicking the First button activates the VBScript First_OnClick Sub procedure. The procedure executes a MoveFirst method, which makes the first row of data the current selection. Clicking the Last button activates the Last_OnClick Sub procedure, which invokes the MoveLast method, making the last row of data the current selection. The remaining navigation buttons work in a similar fashion.

Sub First_OnClick
  	SControl.MoveFirst
End Sub

Sub Next_OnClick
  	SControl.MoveNext
End Sub

Sub Prev_OnClick
  	SControl.MovePrevious
End Sub

Sub Last_OnClick
  	SControl.MoveLast
End Sub

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.