officefileapi-devexpress-dot-spreadsheet-dot-formcontrolcollection-dot-addscrollbar-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md
Adds a scrollbar form control at a specified cell range.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
ScrollbarFormControl AddScrollbar(
CellRange targetRange
)
Function AddScrollbar(
targetRange As CellRange
) As ScrollbarFormControl
| Name | Type | Description |
|---|---|---|
| targetRange | CellRange |
A cell range where the form control should be located.
|
| Type | Description |
|---|---|
| ScrollbarFormControl |
The scrollbar form control.
|
The code sample below creates a scrollbar form control:
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx");
var formControls = workbook.Worksheets[0].FormControls;
var cellRange = workbook.Worksheets[0].Range["B2:B8"];
var scrollbarFormControl = formControls.AddScrollbar(cellRange);
scrollbarFormControl.Min = 2;
scrollbarFormControl.Max = 15;
scrollbarFormControl.LargeChange = 10;
scrollbarFormControl.SmallChange = 1;
Dim workbook As New Workbook()
workbook.LoadDocument("Document.xlsx")
Dim formControls = workbook.Worksheets(0).FormControls
Dim cellRange = workbook.Worksheets(0).Cells("B2:B8")
Dim scrollbarFormControl = formControls.AddScrollbar(cellRange))
scrollbarFormControl.Min = 2
scrollbarFormControl.Max = 15
scrollbarFormControl.LargeChange = 10
scrollbarFormControl.SmallChange = 1
Note
The FormControlCollection.AddScrollbar method call adds a new item to both FormControlCollection and ShapeCollection.
See Also