GrapeCity.Win.MultiRow Namespace > GcMultiRow Class > SetValue Method : SetValue(Int32,String,Object) Method |
Public Overloads Sub SetValue( _ ByVal rowIndex As Integer, _ ByVal cellName As String, _ ByVal value As Object _ )
Dim instance As GcMultiRow Dim rowIndex As Integer Dim cellName As String Dim value As Object instance.SetValue(rowIndex, cellName, value)
Exception | Description |
---|---|
System.ArgumentOutOfRangeException | The rowIndex is less than 0 or greater than the number of Rows minus 1. |
System.ArgumentNullException | The cellName is a null reference (Nothing in Visual Basic) or String.Empty. |
System.ArgumentException | The cellName does not match the name of any Cell in the Row. |
This method sets the Value to the specified cell without instantiating the cell.
Information about instantiating the cell and row:
By default, all the Cells and Rows in a GcMultiRow control do not contain memory, and their process logic and drawing are done by a row and cell template. So, most of the virtual methods exposed in Row and Cell objects need a SectionIndex parameter, so that they can deal with the corresponding operation logic correctly.
After certain operations, in order to save specific cell's data, the relevant row and cell need to be instantiated. The CellStyle.BackColor is different from the template and the LinkLabelCell's LinkLabelCell.LinkVisited property. Instantiating a Row or Cell object requires more memory. The system performance may be effected, so you should avoid using the instantiated methods and properties if possible.
The following methods, properties, or actions will BRING about the instantiation of the Row object |
---|
accessing the current row with the CurrentRow property |
accessing the specific row with the RowCollection.Item property |
copying the row collection with the RowCollection.CopyTo method |
accessing a row collection member with the enumerator (foreach) |
when a user adds a new row with the detached row |
when a user presses Ctrl+Del to delete one or more rows |
hiding one or more rows with the filter function |
the parent row is instantiated when a cell is instantiated |
The following methods, properties, or actions will BRING about the instantiation of the Cell object |
---|
accessing the current cell with the CurrentCell property |
accessing the specific cell with the Item(Int32,Int32) or Item(Int32,String) property |
clicking a LinkLabelCell whose LinkLabelCell.TrackVisitedState property is true |
The following methods will NOT BRING about the instantiation of the Cell or Row object |
---|
getting or setting the Value by invoking GetValue(Int32,Int32) or SetValue(Int32,Int32,Object) method |
getting the FormattedValue by invoking the GetFormattedValue(Int32,Int32) method |
getting the Cell.EditedFormattedValue by invoking the GetEditedFormattedValue(Int32,Int32) method |
accessing the CurrentCellPosition property, but not the CurrentCell or CurrentRow property |
modifying the data with the DataSource |
Note: The above list may not contain all the methods involved with the instantiation action of the row and cell. For more details, refer to the method and property descriptions.
GrapeCity.Win.MultiRow.TextBoxCell text1 = new GrapeCity.Win.MultiRow.TextBoxCell(); GrapeCity.Win.MultiRow.TextBoxCell text2 = new GrapeCity.Win.MultiRow.TextBoxCell(); text1.Name = "text1"; text2.Name = "text2"; text2.Style.Format = "c"; 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[1, 1].Value = 5; gcMultiRow1.SetValue(0, 0, "Value1"); gcMultiRow1.SetValue(1, "text1", 3);
Dim text1 As New GrapeCity.Win.MultiRow.TextBoxCell() Dim text2 As New GrapeCity.Win.MultiRow.TextBoxCell() text1.Name = "text1" text2.Name = "text2" text2.Style.Format = "c" 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(1, 1).Value = 5 GcMultiRow1.SetValue(0, 0, "Value1") GcMultiRow1.SetValue(1, "text1", 3)
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