I have a list that returns from the Database and for every record I need to create a% of dynamic form , I did a search and found some examples for WebForms and I need an example for Windows Forms
It would be something like this, Example:
private void CriarCheckboxDinamicamente()
{
try
{
for (int i = 0; i < 3; i++)
{
this.SuspendLayout();
var chk = new System.Windows.Forms.CheckBox();
chk.Name = "Motivo" + i.ToString();
chk.Text = "Motivo" + i.ToString();
pnlModalMotivo.Controls.Add(chk);
this.ResumeLayout(false);
}
}
catch(Exception ex)
{
MessageBox.Show("Erro: " + ex.Message);
}
}