# C1.Report.FieldCollection.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Report_FieldCollection_Add_" data-uid="C1.Report.FieldCollection.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Report_FieldCollection_Add_" data-uid="C1.Report.FieldCollection.Add*"></a>
<h4 id="C1_Report_FieldCollection_Add_System_String_System_String_System_Double_System_Double_System_Double_System_Double_" data-uid="C1.Report.FieldCollection.Add(System.String,System.String,System.Double,System.Double,System.Double,System.Double)">Add(string, string, double, double, double, double)</h4>
<div class="markdown level1 summary"><p>Adds a <a class="xref" href="C1.Report.Field.html">Field</a> to the collection. This overload adds a legacy field type and is deprecated.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[Obsolete(&quot;This method adds a field of the legacy &#39;do-it-all&#39; Field type, which usually is sub-optimal. In most situations it is better to create a suitable specialized field type (such as TextField) and add it to the Fields collection instead.&quot;)]
public Field Add(string name, string text, double left, double top, double width, double height)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;Obsolete(&quot;This method adds a field of the legacy &#39;do-it-all&#39; Field type, which usually is sub-optimal. In most situations it is better to create a suitable specialized field type (such as TextField) and add it to the Fields collection instead.&quot;)&gt;
Public Function Add(name As String, text As String, left As Double, top As Double, width As Double, height As Double) As Field</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.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>Contains the name of the new field. You should use a consistent naming scheme for the fields
and avoid using duplicate names for report fields and database fields. Using repeated names is legal but will
cause VBScript expressions that use repeated field names to yield unexpected results.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">text</span></td>
      <td><p>Contains the value for the new field's <a class="xref" href="C1.Report.Field.Text.html#C1_Report_Field_Text">Text</a> property. This value
may be treated as a literal or as a VBScript expression, depending on the setting of the field's
<a class="xref" href="C1.Report.Field.Calculated.html#C1_Report_Field_Calculated">Calculated</a> property. By default, <a class="xref" href="C1.Report.Field.Calculated.html#C1_Report_Field_Calculated">Calculated</a> is set to false and the text
is rendered as-is.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">left</span></td>
      <td><p>Left coordinate of the new field, in twips, with respect to its containing section.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">top</span></td>
      <td><p>Top coordinate of the new field, in twips, with respect to its containing section.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">width</span></td>
      <td><p>Width of the new field, in twips.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">height</span></td>
      <td><p>Height of the new field, in twips.</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="C1.Report.Field.html">Field</a></td>
      <td><p>A reference to the newly added field.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Report_FieldCollection_Add_System_String_System_String_System_Double_System_Double_System_Double_System_Double__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>If you add a field to a section's <a class="xref" href="C1.Report.Section.Fields.html#C1_Report_Section_Fields">Fields</a> collection, the new field is automatically 
assigned to that section.</p>
<p>If you add a field to the control's <a class="xref" href="C1.Report.FlexReport.Fields.html#C1_Report_FlexReport_Fields">Fields</a> collection, the new field is not assigned 
to any sections. In this case, you must set the field's <a class="xref" href="C1.Report.FieldBase.Section.html#C1_Report_FieldBase_Section">Section</a> property or it will not be 
rendered in the report.</p>
</div>


<a id="C1_Report_FieldCollection_Add_" data-uid="C1.Report.FieldCollection.Add*"></a>
<h4 id="C1_Report_FieldCollection_Add_System_String_System_String_C1_Interop_Rect_" data-uid="C1.Report.FieldCollection.Add(System.String,System.String,C1.Interop.Rect)">Add(string, string, Rect)</h4>
<div class="markdown level1 summary"><p>Adds a <a class="xref" href="C1.Report.Field.html">Field</a> to the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[Obsolete]
public Field Add(string name, string text, Rect rc)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;Obsolete&gt;
Public Function Add(name As String, text As String, rc As Rect) As Field</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.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>Contains the name of the new field. You should use a consistent naming scheme for the fields
and avoid using duplicate names for report fields and database fields. Using repeated names is legal but will
cause VBScript expressions that use repeated field names to yield unexpected results.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">text</span></td>
      <td><p>Contains the value for the new field's <a class="xref" href="C1.Report.Field.Text.html#C1_Report_Field_Text">Text</a> property. This value
may be treated as a literal or as a VBScript expression, depending on the setting of the field's
<a class="xref" href="C1.Report.Field.Calculated.html#C1_Report_Field_Calculated">Calculated</a> property. By default, <a class="xref" href="C1.Report.Field.Calculated.html#C1_Report_Field_Calculated">Calculated</a> is set to false and the text
is rendered as-is.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="../C1.Document/C1.Interop.Rect.html">Rect</a></td>
      <td><span class="parametername">rc</span></td>
      <td><p>Defines the position of the field, in twips, with respect to its containing section.</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="C1.Report.Field.html">Field</a></td>
      <td><p>A reference to the newly added field.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Report_FieldCollection_Add_System_String_System_String_C1_Interop_Rect__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>If you add a field to a section's <a class="xref" href="C1.Report.Section.Fields.html#C1_Report_Section_Fields">Fields</a> collection, the new field is automatically 
assigned to that section.</p>
<p>If you add a field to the control's <a class="xref" href="C1.Report.FlexReport.Fields.html#C1_Report_FlexReport_Fields">Fields</a> collection, the new field is not assigned 
to any sections. In this case, you must set the field's <a class="xref" href="C1.Report.FieldBase.Section.html#C1_Report_FieldBase_Section">Section</a> property or it will not be 
rendered in the report.</p>
</div>


<a id="C1_Report_FieldCollection_Add_" data-uid="C1.Report.FieldCollection.Add*"></a>
<h4 id="C1_Report_FieldCollection_Add_C1_Report_FieldBase_" data-uid="C1.Report.FieldCollection.Add(C1.Report.FieldBase)">Add(FieldBase)</h4>
<div class="markdown level1 summary"><p>Adds a field or a clone of a field to the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public FieldBase Add(FieldBase field)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(field As FieldBase) As FieldBase</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="C1.Report.FieldBase.html">FieldBase</a></td>
      <td><span class="parametername">field</span></td>
      <td><p>A <a class="xref" href="C1.Report.FieldBase.html">FieldBase</a> object to add to the collection.</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="C1.Report.FieldBase.html">FieldBase</a></td>
      <td><p>A reference to the newly added field.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Report_FieldCollection_Add_C1_Report_FieldBase__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>If the field does not belong to any reports, it is added to the collection. If the field already
belongs to a report, a clone is created and added to the collection.</p>
</div>
</div>
