Hi all,
This is the second text book example from Mr. Samuel Phung's Book.In this section we will develop a Visual Basic based application for testing the serial port on the eBox. The runtime image required for this example remains the same as developed in the previous section, so we can now move on to the application development part.
Step 1:
Launch the VS2005 IDE.
Step 2:
From the IDE, select
files ► New ► Project to bring up the New Project screen.
Step 3:
From the
New Project screen’s left pane, click on and expand the
Other languages node.
Step 4:
Click on and expand the
Visual Basic node followed by the
Smart Device node, and click
Windows CE 5.0.
Step 5:
From the New Project screen’s right pane, click
Device Application.
Step 6:
Enter
SerialPortApp as the name or any other name of your choice.

Step 7:
from the New Project screen, click OK to continue. A blank SerialPortApp will be created by the VS2005 IDE.

Now by default a blank form is created and we need to add various buttons and boxes to this form, these can be found on right hand side of the VS2005 IDE screen.

We can easily choose different buttons from this toolbar and simply drag n drop them onto the blank form.
The various components that are added to our application are as follows
cbSerialPort Combo box to select the active serial port----- COM1, COM2, etc.
btnOpenPort Opens the selected serial port.
btnClosePort Closes the selected serial port.
btnExit Terminates the program.
btnSendMsg Triggers the active serial port to send the message in the txtMsg textbox.
btnClearRecivedMsg Clears the message listed in the txtReceivedMsg textbox.
btnClearSentMsg Clears the message listed in the txtSentMsg textbox.
txtReceivedMsg Textbox to display message received by the active serial port, with multiline enabled.
txtSentMsg Textbox to display message sent by the active serial port.
txtMsg Text to enter message to be sent out by the active serial port.
All the above buttons and boxes can be easily located in the toolbar and their names can be changed in the properties window placed below the toolbar window.
Source Code for the SerialPortApp Application.
First, we need to import some references. Add the following import statements to Form1, in the beginning. In order to view the code window right click on VBSerialPort.vb on the left and click view code.

Now add the following import statements at the beginning,
Import System
Import System.IO.Ports





page 1 page 2 page 3 page 4
Build and deploy process for this application remains the same as the Hello World application.
This is a good way to test the serial ports on the eBox, also before you deploy this application make sure that you have selected the serial port components in the OS image that will be running on the eBox.


These components can found in the device driver section in the Catalog Items of the platform builder.
Thanks all for reading.