I am trying to create a 2d array in my program that can hold CStrings. I need to be able to add my CString to any row and column in the array(not just at the end) and I need it to be able to grow in size. Does anyone know how I could do this?
You can declare an array of type T using static memory like so:
where constInt resolves to an int that is declared const, meaning its value must be known at compile time and cannot be changed at run time. If you don't know what value you want/need for constInt at compile time, then you should declare the array on the heap, using dynamic rather than static memory. That is, you can do this:
cout << "enter value for size" << endl;
cin >> size;
T myArr * = new T;
Technically myArray and myArr aren't the same thing, but they behave the same and can be used interchangably, at least for most intents and purposes. If you don't want to monkey with memory handling yourself then using something like std::vector, which is a class that acts like a souped up array with  operator and everything including memory handling.
CString is MSs string class that acts very much like std::string, if I'm not mistaken. Since the length of any given CString may vary I don't know whether you can do this:
You can try it and see. Likewise you can try the dynamic declaration and see if that works, too. Otherwise, a vector of CStrings should work fine.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...