officefileapi-devexpress-dot-spreadsheet-dot-formcontrolcollection-dot-addbutton-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md
Creates a button form control at the specified cell range.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
ButtonFormControl AddButton(
CellRange targetRange
)
Function AddButton(
targetRange As CellRange
) As ButtonFormControl
| Name | Type | Description |
|---|---|---|
| targetRange | CellRange |
A cell range where the form control should be located.
|
| Type | Description |
|---|---|
| ButtonFormControl |
A button form control.
|
The code sample below creates a button form control:
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");
var cellRange = workbook.Worksheets[0].Range["B2:C4"];
var buttonFormControl = formControls.AddButton(cellRange);
buttonFormControl.PlainText = "Click Here";
buttonFormControl.PrintObject = false;
Dim workbook As New Workbook()
workbook.LoadDocument("Document.xlsx")
Dim cellRange = workbook.Worksheets(0).Range("B2:C4")
Dim buttonFormControl = formControls.AddButton(cellRange)
buttonFormControl.PlainText = "Click Here"
buttonFormControl.PrintObject = False
The following code snippets (auto-collected from DevExpress Examples) contain references to the AddButton(CellRange) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
var buttonCellRange = workbook.Worksheets[0].Range["B2:C2"];
var buttonFormControl = formControls.AddButton(buttonCellRange);
buttonFormControl.PlainText = "Click Here";
var buttonCellRange = workbook.Worksheets[0].Range["B2:C2"];
var buttonFormControl = formControls.AddButton(buttonCellRange);
buttonFormControl.PlainText = "Click Here";
var buttonCellRange = workbook.Worksheets[0].Range["B2:C2"];
var buttonFormControl = formControls.AddButton(buttonCellRange);
buttonFormControl.PlainText = "Click Here";
Dim buttonCellRange = workbook.Worksheets(CInt((0))).Range("B2:C2")
Dim buttonFormControl = formControls.AddButton(buttonCellRange)
buttonFormControl.PlainText = "Click Here"
Dim buttonCellRange = workbook.Worksheets(0).Range("B2:C2")
Dim buttonFormControl = formControls.AddButton(buttonCellRange)
buttonFormControl.PlainText = "Click Here"
See Also