NS Basic/CE Tutorial #1:

A Simple Program


© NSB Corporation. All rights reserved.

Purpose

The purpose of this tutorial is to demonstrate how a simple program is created using NS Basic/CE. You should have NS Basic/CE Desktop IDE installed before beginning this tutorial.

Description of the Program

The program to be developed will display a form with a button on it. When the user taps the button, the program responds with the message

 "Hello--Welcome to NS Basic/CE"

Program Development

1. Startup

2. Modify Form Properties

3. Add a button to the form

Change the button's text:

Resize the button:

Relocate the button on the screen:

4. Add commands to be executed when the button is tapped

 

5. Save the Project

Congratulations! You have now written your first NS Basic/CE program.

Testing The Project

Before you can load your program to test it again, you will have to close it on the device. This isn't as obvious as it looks on a Pocket PC device. The "X" button on the top right corner is actually a minimize button, not a close button, following the rules for all Pocket PC apps.

The easiest to actually close the app is use Settings... System... Memory... Active Programs to stop it before downloading the new one. There are also freeware apps, like Magic Button, that allow you to do this from the Taskbar.

Extending the Tutorial

Let's explore some further features of NS Basic/CE. We'll do this by modifying your first program to be more complicated.

Exit NS Basic/CE Desktop IDE by choosing File and Exit from the menu.

Restart

Revision: Change the message

	Dim today
	today = Date
	MsgBox "Today is " & today

 

Revision: Add code at program startup

	msgbox "HelloPgm will continue when you tap on OK"

This code will be executed when the form is loaded. The program displays the message and waits until the user taps on the OK button

Revision: Update a TextBox in your program

This change will add a TextBox which shows the time-of-day. Another button will be added to cause the time to be updated with the latest time.

Add a TextBox to the form to be used to display the time of day

Add code to fill in the time-of-day when the form displays

	dim t
	t = Now
	fldTime.text = t

 

This code will set the time of day into the TextBox object "fldTime" just after the device displays the form to the user. The statement

	t = Now

gets the current time and stores it in the time variable "t". 

Add a button to redraw the form so that the latest time appears

Add code to the button to cause the redraw

	Hello_Load