I have an array of x link labels that is generated and placed in a table that has 3 columns and n amount of rows, where x is columns * rows.
private void updateLayout(int numRows)
{
int eColCount = editTable.ColumnCount; //-- Edit Column Count (3)
LinkLabel[] eLabels = new LinkLabel[numRows * eColCount]; //-- Array of edit labels to be populated
for (int row = 0; row < numRows; row++)
{
//-- Add new edit row --//
editTable.RowStyles.Add(new RowStyle(SizeType.AutoSize));
editTable.RowCount = numRows - (numRows - row);
for (int col = 0; col < eColCount; col++)
{
//-- Populate columns of new row --//
eLabels[row + col] = new LinkLabel();
popERow(eLabels, row, col); //-- Changes name text based on col index
editTable.Controls.Add(eLabels[row + col], col, row);
}
}
}
I want to create a link clicked event method that launches a new form with a different string variable depending on the row. Here is the link clicked event for a defined label ‘lblLinkEdit’.
private void lblLinkEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
//Launch title edit form
Cursor c = this.Cursor;
this.Cursor = Cursors.WaitCursor;
frmTitleEdit titleEdit = new frmTitleEdit(commitName.Text);
titleEdit.ShowDialog();
this.Cursor = c;
}
Is there a way to make a general method to handle these unique link labels in the array?