# C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle*">SetCellStyle Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_String_C1_Win_FlexGrid_CellStyle_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle(System.Int32,System.String,C1.Win.FlexGrid.CellStyle)">SetCellStyle(int, string, CellStyle)</h4>
<div class="markdown level1 summary"><p>Assigns a custom <a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a> to a cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetCellStyle(int row, string colName, CellStyle newStyle)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetCellStyle(row As Integer, colName As String, newStyle As CellStyle)</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><p>Row index.</p>
</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><p>Column name.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a></td>
      <td><span class="parametername">newStyle</span></td>
      <td><p>The <a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a> to associate with the cell.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_String_C1_Win_FlexGrid_CellStyle__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle.html#C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_String_C1_Win_FlexGrid_CellStyle_">SetCellStyle(int, string, CellStyle)</a> method is useful if you want to assign a new style 
to a single cell. You can also reset the cell style by setting it to null (Nothing, in VB).</p>
<p>To apply a custom cell style to an entire row or column, set the row or column's 
<a class="xref" href="C1.Win.FlexGrid.RowCol.Style.html#C1_Win_FlexGrid_RowCol_Style">Style</a> properties.</p>
<p>To apply a custom style to a range cells, use a <a class="xref" href="C1.Win.FlexGrid.CellRange.html">CellRange</a> object. 
For example:</p>
<pre><code class="lang-csharp">CellRange rg = _flex.GetCellRange(3, 3, 10, 10);
rg.Style = _flex.Styles["MyRangeStyle"];</code></pre>
</div>


<a id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_Int32_C1_Win_FlexGrid_CellStyle_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle(System.Int32,System.Int32,C1.Win.FlexGrid.CellStyle)">SetCellStyle(int, int, CellStyle)</h4>
<div class="markdown level1 summary"><p>Assigns a custom <a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a> to a cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetCellStyle(int row, int col, CellStyle newStyle)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetCellStyle(row As Integer, col As Integer, newStyle As CellStyle)</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><p>Row index.</p>
</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><p>Column index</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a></td>
      <td><span class="parametername">newStyle</span></td>
      <td><p>The <a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a> to associate with the cell.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_Int32_C1_Win_FlexGrid_CellStyle__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle.html#C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_String_C1_Win_FlexGrid_CellStyle_">SetCellStyle(int, string, CellStyle)</a> method is useful if you want to assign a new style 
to a single cell. You can also reset the cell style by setting it to null (Nothing, in VB).</p>
<p>To apply a custom cell style to an entire row or column, set the row or column's 
<a class="xref" href="C1.Win.FlexGrid.RowCol.Style.html#C1_Win_FlexGrid_RowCol_Style">Style</a> properties.</p>
<p>To apply a custom style to a range cells, use a <a class="xref" href="C1.Win.FlexGrid.CellRange.html">CellRange</a> object. 
For example:</p>
<pre><code class="lang-csharp">CellRange rg = _flex.GetCellRange(3, 3, 10, 10);
rg.Style = _flex.Styles["MyRangeStyle"];</code></pre>
</div>


<a id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_SetCellStyle_System_Int32_System_Int32_System_String_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.SetCellStyle(System.Int32,System.Int32,System.String)">SetCellStyle(int, int, string)</h4>
<div class="markdown level1 summary"><p>Assigns a custom <a class="xref" href="C1.Win.FlexGrid.CellStyle.html">CellStyle</a> to a cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetCellStyle(int row, int col, string styleName)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetCellStyle(row As Integer, col As Integer, styleName As String)</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><p>Row index.</p>
</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><p>Column index</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">styleName</span></td>
      <td><p>Name of the new style.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
