# C1.Win.FlexGrid.C1FlexGridBase.Item

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_C1FlexGridBase_Item_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.Item*">this Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_C1FlexGridBase_Item_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.Item*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_Item_System_Int32_System_Int32_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.Item(System.Int32,System.Int32)">this[int, int]</h4>
<div class="markdown level1 summary"><p>Gets or sets the data in a grid cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public object this[int row, int col] { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Default Property Item(row As Integer, col As Integer) As Object</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">row</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">col</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_Item_System_Int32_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This is one of the indexers you can use to get or set the data stored in grid cells.</p>
<p>You can index cells using the row and column indices or using the row 
index and column name.</p>
<p>Using integer indices is more efficient, because the grid doesn't have to 
look up the column. Using column names is more flexible, because references 
remain valid even if the user moves columns to a new position.</p>
<p>When assigning a value to a cell, the grid tries to convert it into the type 
specified for the column (see the <a class="xref" href="C1.Win.FlexGrid.RowCol.DataType.html#C1_Win_FlexGrid_RowCol_DataType">DataType</a> property). If the 
grid can't convert the value, it fires the <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.GridError.html">GridError</a> event and the 
cell retains its original value.</p>
</div>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_Item_System_Int32_System_Int32__examples">Examples</h5>
<p>The example below creates a column and assigns it a name, then sets the value of
a cell using the column index and retrieves the value using the column name:</p>
<pre><code class="lang-csharp">// create a column, assign it a name and get the new index
Column myCol = flex.Cols.Add();
myCol.Name = "address";
myCol.DataType = typeof(string);
int colIndex = myCol.Index;

// assign a value to a cell using cell coordinates:
flex[1, colIndex] = "555, Broadway";

// get the value using the column name
string address = (string)flex[1, "address"];
MessageBox.Show("The address is " + address);</code></pre>



<a id="C1_Win_FlexGrid_C1FlexGridBase_Item_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.Item*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_Item_System_Int32_System_String_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.Item(System.Int32,System.String)">this[int, string]</h4>
<div class="markdown level1 summary"><p>Gets or sets the data in a grid cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public object this[int row, string colName] { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Default Property Item(row As Integer, colName As String) As Object</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">row</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">colName</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_Item_System_Int32_System_String__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This is one of the indexers you can use to get or set the data stored in grid cells.</p>
<p>You can index cells using the row and column indices or using the row index and column name.</p>
</div>
</div>
