How to bind ComboBox to a datagridview in a windows form
I Have to bind a comboBox to a datagridview in a windows form application. i have used the below code.
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.HeaderText = "Installation";
cmb.Name = "cmb";
cmb.MaxDropDownItems = 3;
cmb.Items.Add("--SELECT--");
cmb.Items.Add("Pre-Installation");
cmb.Items.Add("Installation");
cmb.Items.Add("Post-Installation");
By using the this code comboBox is binded in gridview, But it is displaying on the topside of the column, I need to display the comboBox to the center of the column and
--Select-- should display by default.
For displaying comboBox to center i have used this
cmb.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
Thanks in advance