Create a project in Visual Studio and add DataGridView to the Form.
Add the following code to the Form1.cs class.
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AddCheckBoxToDataGridView
{
public partial class Form1 : Form
{
DataGridViewCheckBoxColumn column;
public Form1()
{
InitializeComponent();
dropDownCell();
}
private void dropDownCell()
{
column = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add(column);
column.FlatStyle = FlatStyle.Flat;
}
}
}
See the result by running the project.
Do not forget to leave your comments below.
No comments:
Post a Comment