This article describes how to create a MessageBox in a LightSwitch Application (Visual C#) in Visual Studio 2012.
The following is the procedure for creating a MessageBox in LightSwitch 2012.
Step 1
Open the Solution Explorer.
Step 2
In the Solution Explorer, right-click on the Screens and choose "Add Screen".
Step 3
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 some name to the Screen and click "OK" button.
Step 4
The Screen Designer appears.
Step 5
Click on "Add", a drop down list will appear and select the "New" button.
The Add Button dialog box appears on the screen.
Now the screen designer contains a button.
Step 6
Right-click on that button and and select the "_Execute" method.
The code designer appears.
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 MessageBox_Execute()
{
this.ShowMessageBox("Are you sure you want to delete this item?","Delete Confirm", MessageBoxOption.OkCancel);
}
}
}
Step 7
Press F5 to run the application.
Click on that button; the dialog box appears on the screen.