mardi 18 décembre 2018

Read Checkboxvalues that were dynamically created in a Datatable c#

I have this code that dynamically created my checkboxes. I have several columns of checkboxes and several rows, so it needs to be totally dynamical.

I don't know how i can read the values of the checkboxes and would like to ask for some help. BTW I would like to save the values in a multidimensional array.

Meldungtable.Columns.Add("Warnungen", typeof(string));

  for (int meldungcnt = 0; meldungcnt < SPSWarnungsBausteinArray.Length; meldungcnt++)
  {
    Meldungtable.Rows.Add(SPSWarnungsBausteinArray[meldungcnt]);
  }
  WarnungenDataGridView.DataSource = Meldungtable;

  for (int kameracnt = 1; kameracnt <= Kameraanzahl; kameracnt++)
  {
    DataGridViewCheckBoxColumn Kamerachk = new DataGridViewCheckBoxColumn();
    Kamerachk.HeaderText = "Kamera" + kameracnt;
    Kamerachk.Name = "KameraChkBox" + kameracnt;
    Kamerachk.Width = 70;
    WarnungenDataGridView.Columns.Add(Kamerachk);
  }

I would read row by row and check for the checkbox name, that i have assigned before, but as I am reading the data in a different method I don't think this works out.

Please help




Aucun commentaire:

Enregistrer un commentaire