jeudi 19 avril 2018

Change tiny int in datagridview with checkbox

I'm populating datagridview with data from MySQL database, one of the values was set to tiny int (boolean), I would like it to look like a checkbox in DGV instead of 0 and 1, how can I do this?

My code for pushing data in DGV.

            MySqlConnection myConn = new MySqlConnection(conStr);
            adapter = new MySqlDataAdapter();
            adapter.SelectCommand = new MySqlCommand(query, myConn);
            MySqlCommandBuilder cb = new MySqlCommandBuilder(adapter);
            myConn.Open(); //da.Fill(ds, sTable); da.Update(ds, sTable); myConn.Close();

            ds = new DataSet();
            adapter.Fill(ds, sTable);
            myConn.Close();

            dataGridView1.Refresh();

            dataGridView1.DataSource = ds;
            dataGridView1.DataMember = sTable;
            dataGridView1.Columns[0].Visible = false; 

I need last column to be checkboxes and react accordingly with tiny int, column number is 7.




Aucun commentaire:

Enregistrer un commentaire