# GrapeCity.Win.Spread.InputMan.CellType.CalculatorButtonMappingCollection.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Win_Spread_InputMan_CellType_CalculatorButtonMappingCollection_Add_" data-uid="GrapeCity.Win.Spread.InputMan.CellType.CalculatorButtonMappingCollection.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Win_Spread_InputMan_CellType_CalculatorButtonMappingCollection_Add_" data-uid="GrapeCity.Win.Spread.InputMan.CellType.CalculatorButtonMappingCollection.Add*"></a>
<h4 id="GrapeCity_Win_Spread_InputMan_CellType_CalculatorButtonMappingCollection_Add_System_Windows_Forms_Keys_System_String_" data-uid="GrapeCity.Win.Spread.InputMan.CellType.CalculatorButtonMappingCollection.Add(System.Windows.Forms.Keys,System.String)">Add(Keys, string)</h4>
<div class="markdown level1 summary"><p>Adds an item to the <a class="xref" href="GrapeCity.Win.Spread.InputMan.CellType.CalculatorButtonMappingCollection.html">CalculatorButtonMappingCollection</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int Add(Keys key, string buttonKey)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(key As Keys, buttonKey As String) As Integer</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.windows.forms.keys">Keys</a></td>
      <td><span class="parametername">key</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.keys">Keys</a> value indicates the special key.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">buttonKey</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a> value indicates thekey of the button.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a> value indicates the index of the item.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></td>
      <td><p>The <i>buttonKey</i> can't be <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> or <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string.empty">Empty</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></td>
      <td><p>The <i>buttonKey</i> isn't a correct button key in the calculator, you can get all button keys from <a class="xref" href="GrapeCity.Win.Spread.InputMan.CellType.DropDownCalculator.ButtonKeys.html#GrapeCity_Win_Spread_InputMan_CellType_DropDownCalculator_ButtonKeys">ButtonKeys</a> property.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></td>
      <td><p>There is a same <i>key</i> had been added before, please change another one.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
