Question

I have a Class(Conatiner) object in a tablelayoutpanel cell. I want to access that textfield in that specific field. How can I take the values on a button click?

I want to access the 1 2 3 with the Channel and the X and Y values. But I do not know the number objects in the tableLayoutPanel

Here is the code I have written so far

private void masterTab1_SaveButton_Click(object sender, EventArgs e)
{

   var colWidths = this.MatrixPanel.GetColumnWidths();
   var rowHeights = this.MatrixPanel.GetRowHeights();
   int col = -1, row = -1;
   int offset = 0;
   for (int iRow = 0; iRow < this.MatrixPanel.RowCount; ++iRow)
   {
       offset += rowHeights[iRow];
       row = iRow;
       for (int iCol = 0; iCol < this.MatrixPanel.ColumnCount; ++iCol)
       {
           offset += colWidths[iCol];
           col = iCol;

           var myCellControl = MatrixPanel.GetControlFromPosition(col, row);
           if (myCellControl is Container)
           {
              Adapter.insertposition(RackID, row, col, //Want the Channel Value  , "Ready");
           }
       }
   }
}

enter image description here

Was it helpful?

Solution

if your "Container" class is properly setup/has all the properties or controls you need to get the information you want, then i believe what you are looking for is this:

if (myCellControl is Container)
{
   Container tmp = myCellControl as Container;
   //after this point, you can reference the controls/properties of your
   //Container class/control using tmp... see example below as i do not know
   //what your Container control exposes as far as properties are concerned.
   Adapter.insertposition(RackID, row, col, tmp.ChannelValue, "Ready");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top