NS Basic/Desktop Tutorial #1:

A Simple Program


© 2016 NS BASIC Corporation. All rights reserved.

Purpose

The purpose of this tutorial is to demonstrate how a simple program is created using NS Basic/Desktop. You should have NS Basic/Desktop Desktop IDE installed before beginning this tutorial. You can use the Demo or the full version.

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/Desktop"

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/Desktop program.

Testing The Project

 

Extending the Tutorial

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

Exit NS Basic/Desktop 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",0,"Hello"

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