Step1
Create the table
Let's create a sample form on which we can play, one that is something you would use in real life. Create a table with four rows and two columns. Merge the cells in the first and last rows.
Step2
First thing to do, add in the verbiage so we know what we're looking. Row 1: "Login Page"
Row 2 Column 1: "User Name: "
Row 3 Column 1: "Password: "
Step3
Completed Table
From the Toolbox, add the following:
Row 2 Column 2: HTML Input box type=text
Row 3 Column 3: HTML Input box type=password
Row 4: Button
Step4
There are a couple properties to be specified in the input boxes. We must include "ID" and "runat". In the User Name Input box add: id="txtUserName" runat="server". In the Password Input box: id="txtPassword" runat="server".
Step5
Change the name of the button to "Login" and add an OnClick event through the Events window available while in Design view. It can be left empty.
Step6
While in source view, place your cursor immediately after the Input box closing tag. Insert a RequiredFieldValidator from the Toolbox. An open and close tag will be created for you, along with some default information. In-between the new tags, insert an asterisk which will server as the reminder that information is missing. To make the aster stand out, add the following to open Validator tag:
Forecolor="red"
Step7
As it stands the Validator checks nothing. To make it keep a watchful eye on the UserName Input box, add the following to the open Validator tag:
ControlToValidate="txtUserName"
Step8
Design View
Repeat the previous two step for the txtPassword Input box. Insert the validator, add the asterisk, change the Forecolor to red and finally add the ControlToValidate. Be sure to change use "txtPassword" rather than "txtUserName". If you forget, both validators will be watching the same Input box.
Step9
Run the VB web application to test it. Try leaving the User Name empty. Once the button is clicked, the Validator is fired and the red asterisk becomes visible. The Validator will not allow the form to be submitted until the field has content. When the requirement has been met, the red asterisk will disappear.