Simple Example The Text LCD

<< Back to the SharedPhidgets page

What you will learn in this tutorial:

  • how to create a SharedPhidgets TextLCD object,
  • how to assign a specific serial number to this TextLCD,
  • how to use the TextLCDSkin and
  • how to change the TextLCD displayed text from within your application.

Download source:
The zip file contains the program code of this example.


The Phidget TextLCD
The Phidget TextLC display
  1. Create a new Windows C# application in VisualStudio.NET
  2. Use the ConnectionManager for connecting to the server
  3. Create a TextLCD object
  4. Create a TextLCDSkin and connect it to the TextLCD object
  5. Change the displayed text of the display from within your code
  6. Finished! Compile the application.

Step-by-step in detail

1) Open VisualStudio.NET, click New Project, select a new C# Windows application, enter the name of the project (SharedPhidgetsExample_TextLCD) and confirm the dialog.

2) Now we click on the SharedPhidgets toolbox on the left side of the VisualStudio window, select the ConnectionManager object and click on your Windows form.

Then change the SharedDictionaryURL property of the Connection Manager to the address of the server:

3) Drag a SharedPhidget TextLCD component on your form

...and click on the FilterSerialNumber property in the Properties explorer of Visual Studio...

...and specify the serial number of the TextLCD. If you have only one TextLCD connected to your infrastructure (that means: only one TextLCD connected to one of the SharedPhidgets Connectors that are connected with the server), you don't need to add the serial number because the component will then connect to the only component of its type it founds.

4) Create a skin object for the TextLCD (TextLCDSkin): Just click on the entry in the toolbox and click-and-hold to create the control on your Windows form.

Change the TextLCD property of the TextLCDSkin to the object of the created TextLCD, here this is textLCD1

5) Create two buttons on the form, and set the Text property of the buttons to "First Message" and "Second Message":

Create new event handlers for the Click event of the buttons: just doubleclick the buttons, and VisualStudio.NET will create the event handler methods.

Insert the following code lines in these callback methods: they will change the displayed text of the TextLCD.

private void button1_Click(object sender, System.EventArgs e)
  this.textLCD1.Display = "My first message for the display!";

private void button2_Click(object sender, System.EventArgs e)
  this.textLCD1.Display = "Another message for the display...";

6) Compile your application:

The following window will appear, where you can see the SKin for TextLCD. You can change the text by typing in the textbox, or you can click on the buttons to display the preset texts.

That's it,

you can now modify this application and add additional features.