Spread Windows Forms 10.0 Product Documentation
Add Method (SideButtonCollection)
Example 


The SideButtonBase to add.
Adds the specified SideButtonBase to the collection.
Syntax
'Declaration
 
Public Function Add( _
   ByVal value As SideButtonBase _
) As Integer
'Usage
 
Dim instance As SideButtonCollection
Dim value As SideButtonBase
Dim value As Integer
 
value = instance.Add(value)
public int Add( 
   SideButtonBase value
)

Parameters

value
The SideButtonBase to add.

Return Value

The index at which the new element was inserted.
Example
This example displays a message when you select the button.
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType inputcell1 = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
inputcell1.Multiline = true;
inputcell1.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo() { Text = "A" });
fpSpread1.Sheets[0].Cells[1, 1].CellType = inputcell1;

private void SideButton_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Side Button Clicked");
        }

        private void fpSpread1_EditModeOn(object sender, EventArgs e)
        {
            if (fpSpread1.EditingControl is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
            {
                GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl c = (GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)fpSpread1.EditingControl;
                c.SideButtons[0].Click += SideButton_Click;
            }
        }

        private void fpSpread1_EditModeOff(object sender, EventArgs e)
        {
            if (fpSpread1.EditingControl is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
            {
                GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl c = (GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)fpSpread1.EditingControl;
                c.SideButtons[0].Click -= SideButton_Click;
            }
        }
Dim inputcell1 As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
inputcell1.Multiline = True
inputcell1.SideButtons.Add(New GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo() With {.Text = "A"})
FpSpread1.Sheets(0).Cells(1, 1).CellType = inputcell1

Private Sub SideButton_Click(sender As Object, e As EventArgs)
        MessageBox.Show("Side Button Clicked")
    End Sub

    Private Sub FpSpread1_EditModeOn(sender As Object, e As EventArgs) Handles FpSpread1.EditModeOn
        If TypeOf FpSpread1.EditingControl Is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl Then
            Dim c As GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl = DirectCast(FpSpread1.EditingControl, GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
            AddHandler c.SideButtons(0).Click, AddressOf SideButton_Click
        End If
    End Sub

    Private Sub FpSpread1_EditModeOff(sender As Object, e As EventArgs) Handles FpSpread1.EditModeOff
        If TypeOf FpSpread1.EditingControl Is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl Then
            Dim c As GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl = DirectCast(FpSpread1.EditingControl, GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
            RemoveHandler c.SideButtons(0).Click, AddressOf SideButton_Click
        End If
    End Sub
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

SideButtonCollection Class
SideButtonCollection Members

 

 


Copyright © GrapeCity, inc. All rights reserved.