VB Interface for Arduino Tutorial Series Part 2: VB Form

This is part 2 of the Creating a Visual Basic Interface for Arduino Tutorial.

In the second part of the tutorial, we’re going to build our Windows form for project. If you haven’t already downloaded the code, you can grab it at GitHub.

Adding Controls

programThis is what the final program looks like. On the surface, there are two ComboBoxes, two TextBoxes, three Buttons, and one TrackBar. In the editor, you’ll have to add a couple more controls that aren’t visible controls. They are a SerialPort and a Timer.

visualstudioHere are the main controls in the form and some important settings:

“SerialPort” – SerialPort

“Timer1” – Timer, with interval of 100.

“cboxCOMport” – ComboBox

“btnConnect” – Button

“cboxPin” – ComboBox

“txtSpeed” – TextBox, ReadOnly  true.

“trkSpeed” – TrackBar, with min of 0, max of 180, and value (default on form load) 90.

“btnSetZero” – Button

txtZero” – TextBox, ReadOnly true.
“panelHide” – Panel, docked fill.

Hiding Controls

You may have noticed in the previous picture that there was nothing in the bottom section of the program. Until the program is connected to an Arduino, a Panel, “panelHide”, is used to hide the controls that set the parameters that will be sent to the Arduino.

visualstudio_panel

The panel is above all of the other controls so that it covers them. When you’re designing the form, it will be in the way. To temporarily move it out of the way, open the Document Outline in View > Other Windows > Document Outline, which is shown on the left in the picture above. In the Document Outline, you can move around the layers, so you can move the Panel underneath all of the controls so you can get to them. Just remember to move the Panel back as the top layer when you’re done.

Coming up next: VB Code

In the next part of the tutorial, we’ll finish off the project by programming this Windows form we just designed! Stay tuned!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s