Hello,
I am fairly new at C++ so I apologise if this is a silly question:
I am trying to create a forms based application in which a whole bunch of textboxes are created when the form is loaded:
Code Block: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)public
{
....
TextBox* TB[,] =
new TextBox * [8,8] ; for (int i=0; i<8; i++)for (int j=0; j<8; j++){
{
new TextBox;TB[i,j] =
tabPage1->Controls->Add(TB[i,j]);
TB[i,j]->Location = System::Drawing::Point(10 + 45 + 45 * j, 10 + 25 + 25 * i);
TB[i,j]->Size = System::Drawing::Size(40, 20);
TB[i,j]->Text = Convert::ToString(corrMatrixPre[i][j]);
}
}
...
}
This all works fine. I then have a Button, which when pushed runs a programme. I now want to use the text in the textboxes created during runtime as inputs:
Code Blockprivate
: System::Void toolBar1_ButtonClick(System::Object * sender, System::Windows::Forms::ToolBarButtonClickEventArgs * e){
...
{
penIns.corrMatrixPre[i][j]=Convert::ToDouble(Form1::TB[i,j]);
}
...
}
I get an error : TB is not a member of Form1. How do I access these objects that are created at runtime
Many Thanks,
Neil