mardi 21 mars 2017

c# WinForm if dynamic checkbox is checked (acces from a different function)

Thanks in advance for your interest.
This is what I have...

private void blablabla()
{
  for (int i=1; i<count+1; i++)
  {
    int item_number = panelBoats.Controls.Count;
    CheckBox chb = new CheckBox();
    chb.Name = "CheckBoxBoat" + i.ToString();
    chb.Text = "Boat " + i.ToString();
    chb.Location = new Point(10, item_number * 15);
    panelBoats.Controls.Add(chb);
  }
}

This is what I which would work...

private void plotMarker(PaintEventArgs e)
{
    if(CheckBoxBoat0.Checked)
    {
         MessageBox.Schow('Yehaaa');
    }
 }

Thanks again,

Dimitri




Aucun commentaire:

Enregistrer un commentaire