How to get the value of a combobox inside a datagridviewr

0

I have the following situation, I have a combobox in a cell of datagridviewr, now I need to get the value of this cell only after selecting the item in combobx, but I am not getting it because clicking on the cell is already occurring before I select the item in the combobox, which option should I use to do this action only after the item in the combobox is selected.

Followthecodesnippet

privatevoiddgw_cadastro_CellClick(objectsender,DataGridViewCellEventArgse){if(dgw_cadastro.Rows[e.RowIndex].Cells[6].Value.ToString()=="R$")
            {
                SqlCommand REAL = new SqlCommand(@"SELECT SM2.M2_MOEDA1 FROM SM2010 AS SM2 WHERE SM2.M2_DATA = CONVERT(DATE, '26/03/2018', 103)", conex);
                REAL.Connection = conex;
                REAL.CommandType = CommandType.Text;
            try
            {
                SqlDataReader dr = REAL.ExecuteReader();
                DataTable dt = new DataTable();
                dt.Load(dr);

                txt_moeda.Text = "SM2.M2_MOEDA1";
            }
            catch (Exception)
            {

                throw;
            }
        }
        else
        {
            MessageBox.Show("Erro");
        }

Thank you in advance.

    
asked by anonymous 26.03.2018 / 16:06

0 answers