jeudi 17 mars 2016

Trasformation one column of DataGridView to DataGridViewCheckBox

i have this problem ..

applicant  |  module  |  date  |  approvation  | 
  xxxx         xxxx      xxxx        xxxxxxx
  yyyy         yyyy      yyyy        yyyyyyy
  tttt         tttt      tttt        ttttttt

I have this db table ... After query i assign DataTable in my DataGridView..

                QueryAssist qa = new QueryAssist();
                DataTable dt = new DataTable();
                dt = qa.runQuery('myquery');

                dgvApprovazione.DataSource = dt;
                dgvApprovazione.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);

// modify, transform 2nd column in cellLink
                foreach (DataGridViewRow row in dgvApprovazione.Rows)
                {
                    row.Cells[1] = new DataGridViewLinkCell();
                }

now i want to transofrm column approvation that is a string : or 'approved' or 'not approved'..

if value of this cell is approved checkbox is checked and not modified (onlyread)

something similar...

 foreach (DataGridViewRow row in dgvApprovazione.Rows)
                {
                    if (row.Cells[3].Value.ToString().Equals("APPROVED"))
                    {
                        row.Cells[3] = new DataGridViewCheckBoxCell();
                    }
                } 
i have a problem to implement ... help me. 

It's possible ? How?

repeat :

I want to change a column that value contain is a text/string (approved or not approved ) in checkbox (checked or unchecked)

Sorry for bad english ..




Aucun commentaire:

Enregistrer un commentaire