Step 2 of 3: Adding Code to the Application

In the previous steps you set up the application's user interface and added five C1NumericBox controls to the application. In this step you'll add code to your application to finalize the application.

Complete the following steps:

1.   Select View | Code to switch to Code view.

2.   Add the following imports statements to the top of the page:

      Visual Basic

      C#

3.   Initialize the following global variables just inside the MainPage class:

      Visual Basic

      C#

These numbers will be used as the correct 'code' in the application. When the user enters the correct combination of numbers at run time the button will appear.

4.   Add the following Click event handler to the code:

      Visual Basic

      C#

When the button is pressed at run time it will open the ComponentOne Web site.

5.   Next add the following custom NBValidation event to your code:

      Visual Basic

      C#

When the user enters the correct numbers (as indicated in step 3 above) the C1NumericBox controls will be set to read only and will no longer be editable, the text of the label below the controls will change to indicate the correct code has been entered, and a button will appear allowing users to enter the ComponentOne Web site.

6.   Add C1NumericBox_ValueChanged event handlers to initialize NBValidation. The code will look like the following:

      Visual Basic

      C#

In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.