Dynamic StringGrid C++ Builder <p>I created a program in C++Builder 6 and I have a problem now.</p> <p>I have 6 files: <code>Unit1.cpp</code>, <code>Unit1.h</code>, <code>Unit2.cpp</code>, <code>Unit2.h</code>, <code>Unit3.cpp</code>, <code>Unit3.h</code>.</p> <p><code>Unit1.cpp</code> is file for main form.</p> <p>Problem : I want to create in Function <code>void __fastcall TForm3::Button1Click(TObject *Sender)</code> a <code>TStringGrid</code> which will be visible in <code>Unit1.cpp</code> and <code>Unit2.cpp</code>. Next click should create new <code>TStringGrid</code> with new name(previous exist)</p> <p>I tried to fix my problem, I wrote some code, but it is not enough for me.<br> In <code>Unit1.h</code> I added: </p> <pre><code>void __fastcall MyFunction(TStringGrid *Grid1); </code></pre> <p>In <code>Unit1.cpp</code> I added: </p> <pre><code>void __fastcall TForm1::MyFunction(TStringGrid *Grid1) { Grid1 = new TStringGrid(Form2); Grid1-&gt;Parent = Form2; } </code></pre> <p>In <code>Unit3.cpp</code> I added:</p> <pre><code>#include "Unit1.h" </code></pre> <p>and the Button click function is: </p> <pre><code> void __fastcall TForm3::Button1Click(TObject *Sender) { Form1-&gt;MyFunction(Form1-&gt;Grid); //Grid was declarated previous in Unit1.h } </code></pre> <p>Now when I used this method I dynamically create a <code>TStringGrid</code>, but only one. How do I create as many <code>TStringGrid</code>s (with unique names) as the number of times the button is pressed? (Now i must declarate <code>TStringGrid</code> in <code>Unit1.h</code>).</p>