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


The row index of the cell.
The cell index.
Retrieves the specified cell value.
Syntax
Public Overloads Function GetValue( _
   ByVal rowIndex As Integer, _
   ByVal cellIndex As Integer _
) As Object
Dim instance As GcMultiRow
Dim rowIndex As Integer
Dim cellIndex As Integer
Dim value As Object
 
value = instance.GetValue(rowIndex, cellIndex)
public object GetValue( 
   int rowIndex,
   int cellIndex
)

Parameters

rowIndex
The row index of the cell.
cellIndex
The cell index.

Return Value

A System.Object that indicates the specified cell value.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeException

The rowIndex is less than 0 or greater than the number of Rows minus 1.

-or-

The cellIndex is less than 0 or greater than the number of Cells in the Row minus 1.

Remarks

This method returns the Value of the specified cell without instantiating the cell.

Information about instantiating the cell and row:

By default, all the Cells and Rows in one GcMultiRow control have no memory, and their process logic and drawing are done by one row and cell template. So, most of the virtual methods exposed in the row and cell need a SectionIndex parameter, so that they can deal with the corresponding operation logic correctly.

The relevant Row and Cell objects need to be instantiated after certain operations, in order to save a specific cell's data. The CellStyle.BackColor is different from the template or 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 the 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 property

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.

Example
This example uses the GetValue method.
private void Form1_Load(object sender, EventArgs e)
        {
            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;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.Items.Add(gcMultiRow1.GetValue(1,1).ToString());
            listBox1.Items.Add(gcMultiRow1.GetValue(1,"text2").ToString());
        }
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        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
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ListBox1.Items.Add(GcMultiRow1.GetValue(1,1).ToString())
        ListBox1.Items.Add(GcMultiRow1.GetValue(1,"text2").ToString())
End Sub
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.