GrapeCity MultiRow Windows Forms Documentation
AddSelection(Int32,Int32) Method
Example 


The row index of the cell.
The cell index of the cell.
Selects the specified Cell.
Syntax
Public Overloads Sub AddSelection( _
   ByVal rowIndex As Integer, _
   ByVal cellIndex As Integer _
) 
Dim instance As GcMultiRow
Dim rowIndex As Integer
Dim cellIndex As Integer
 
instance.AddSelection(rowIndex, cellIndex)
public void AddSelection( 
   int rowIndex,
   int cellIndex
)

Parameters

rowIndex
The row index of the cell.
cellIndex
The cell index of the cell.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeException

The rowIndex is less than 0 or greater than or equal to the RowCount property.

-or-

The cellIndex is less than 0 or greater than or equal to the owner Section's Section.Cells count.

System.InvalidOperationExceptionThe specified value is true and the target Cell is invisible or unselectable.
Remarks
Initially, all cells and rows do not have an actual instance in the GcMultiRow control. When you get a cell or row's instance, the cell creates an instance. That policy saves memory and improves performance. A cell instance is created if you select a specific cell by setting the Cell.Selected property value to true. To avoid this state, call this method instead of setting the property directly. This method's function and setting the Cell.Selected property's value to true are the same.
Example
This example uses the AddSelection method.
GrapeCity.Win.MultiRow.TextBoxCell text1 = new GrapeCity.Win.MultiRow.TextBoxCell();
GrapeCity.Win.MultiRow.TextBoxCell text2 = new GrapeCity.Win.MultiRow.TextBoxCell();
GrapeCity.Win.MultiRow.Template template1 = GrapeCity.Win.MultiRow.Template.CreateGridTemplate(new GrapeCity.Win.MultiRow.Cell[] { text1, text2 }, 160, GrapeCity.Win.MultiRow.AutoGenerateGridTemplateStyles.ColumnHeader | GrapeCity.Win.MultiRow.AutoGenerateGridTemplateStyles.RowHeaderAutoNumber);
template1.ColumnHeaders[0].Cells[0].Value = "Column1";
template1.ColumnHeaders[0].Cells[1].Value = "Column2";            
gcMultiRow1.Template = template1;
gcMultiRow1.RowCount = 3;
gcMultiRow1.AddSelection(0);
//gcMultiRow1.AddSelection(0, 1);
Dim text1 As New GrapeCity.Win.MultiRow.TextBoxCell()
Dim text2 As New GrapeCity.Win.MultiRow.TextBoxCell()
Dim template1 As GrapeCity.Win.MultiRow.Template = GrapeCity.Win.MultiRow.Template.CreateGridTemplate(New GrapeCity.Win.MultiRow.Cell() {text1, text2}, 160, GrapeCity.Win.MultiRow.AutoGenerateGridTemplateStyles.ColumnHeader Or GrapeCity.Win.MultiRow.AutoGenerateGridTemplateStyles.RowHeaderAutoNumber)
template1.ColumnHeaders(0).Cells(0).Value = "Column1"
template1.ColumnHeaders(0).Cells(1).Value = "Column2"
GcMultiRow1.Template = template1
GcMultiRow1.RowCount = 3
GcMultiRow1.AddSelection(0)
'GcMultiRow1.AddSelection(0, 1)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GcMultiRow Class
GcMultiRow Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.