always gull

always gull

  • NA
  • 32
  • 0

Combo box in data grid view

Feb 16 2009 3:21 PM
Hi
I am new to programing. I am doing a project for booking system for a computer shop, which have a Form repair and field called Status which can have only three values Ready, Waiting for part and In queue. I wan add a combo box in this field so the user can select one value.I seen some of the example to add combo box in the data grid of c sharp but all those example are for text box not for the grid cell. I am creating my grid by drag and drop and then populating it with data programaticaly, i want when i populate grid with data base Status field have combo box and the value in combo box comes from the data base. This is my code

//Intializing Connection
            ConnectionClass conn_obj = new ConnectionClass();
            SqlConnection store_connection = conn_obj.connect();

            //Intializing RepairClass Object
            RepairClass rep_obj = new RepairClass();

            //Intializing Dataset
            ds_rep = new DataSet();

            // Storing Query in a variable
            string cmd_rep2 = rep_obj.AllRepairStatus(rep_status, store_connection);

            //Intializing The Data Adapter
            da_rep = new SqlDataAdapter(cmd_rep2, store_connection);

            //Filling The Data adapter Data Set
            da_rep.Fill(ds_rep, "Repair");


            //Filling The Data Grid With Data Set
            dgRepair.DataSource = ds_rep.DefaultViewManager;
            dgRepair.DataMember = "Repair";
            ds_rep.WriteXml(@"employee.xml");

            //Making The Id Columns ReadOnly
            dgRepair.Columns["Id"].ReadOnly = true;
            dgRepair.Columns["MacId"].ReadOnly = true;
            dgRepair.Columns["CusId"].ReadOnly = true;

is anyone can help me this is very important. Thanks in advance,

Answers (3)