Introduction
As you know that add button is used to add new data in the database. There is + sign to add new data in Visual Studio LightSwitch . If you want to add new data using custom button in the LightSwitch, it is possible.
Step by step solution
Step 1: Open Visual Studio LightSwitch->File->New->Project->Create new table.

Step 2: Now we will make a table like as Employee.

Step 3: Right click on screen->Add new screen.

Step 4: Select Editable grid screen->Select screen data (Employee)->Ok.

Step 5: Run application (Press F5)->Click + sign ->Fill data->Ok->Save.

Step 6: Design screen->Command Bar->Add->New button->Change display name (AddEmployee)->Save.

Step 7: Stop debugging->Add screen->Select new data screen->Select screen data (Employee)->Ok.

Step 8: Go to properties of Editable
grid screen->Change method name (AddEmployee)->Click edit execute code>Write the below code.

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
EditableEmployeesGrid
{
partial void
ADDEmployee_Execute()
{
this.Application.ShowCreateNewEmployee();
}
}
}
Step 9: Run application (Press F5)->Click AddEmployee button.

Step 10: Fill data->Save.

Step 11: Refresh.Here you will see new data save in the editable grid screen.

Summary
So you can use custom button as add in the LightSwitch Appliocation.

Comments
Join the conversation! Your thoughts help the community grow.