This article shows how to display a Static Label Text on the screen using a LightSwitch Application (Visual C#) in Visual Studio 2012.
The following is the procedure for displaying a static label text on the screen.
Step 1
Open the Solution Explorer.
![sol ex.jpg]()
Step 2
In the Solution Explorer, right-click on the server and choose "Add Table".
![add table.jpg]()
Step 3
The table appears.
Emp Table
![table.jpg]()
Step 4
In the Solution Explorer, right-click on the Screens and choose "Add Screen".
![add src.jpg]()
Step 5
The Add New Screen dialog box appears. Select the "New Data Screen" from the Screen Template, under screen information, choose "None" under screen data and provide a name for the Screen and click the "OK" button.
![add new src.jpg]()
Step 6
The screen designer appears.
Step 7
Click on "Add Data Item" in the menu bar.
![add data item.jpg]()
Step 8
The Add Data Item dialog box appears on the screen. Select the "Local Property" radio button and choose "String" as the type. Name this property "LabText".
![local prop dialog.jpg]()
Step 9
In the Screen Designer click on the "Add" dropdown list and choose "LabText".
![add labtext.jpg]()
Step 10
By default "LabText" consists of the "TextBox" control. We can use the drop down list to change the control to a "Label".
![label.jpg]()
Step 11
Go to the property window of Labtext and set the Label Position to "None".
![correct prop.jpg]()
Step 12
Click on the Write Code drop down list in the menu bar and choose the "_Activated" method.
![activated.jpg]()
In the code editon we perform the following code:
using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
namespace LightSwitchApplication
{
public partial class CreateNew
{
partial void CreateNew_Activated()
{
// Write your code here.
Labtext = "Welcome to MCN Solutions, Noida";
}
}
}
Step 13
Press F5 to run the application.
![output.jpg]()