Manejo de eventos DataGridViewTextBoxColumn y DataGridViewComboBoxColumn

I have a Windows form which has a tab control. Each tab has one data gridview. I would get either a combo box values (array of strings) or a text box value (single string) from the database. Based on the values I am creating either DataGridViewTextBoxColumn or DataGridViewComboBoxColumn dynamically and adding it to the datagridview.

Now I want to handle the events of all the DataGridViewTextBoxColumn y DataGridViewComboBoxColumn in the data gridview in each tab. I want to know how to handle this situation and any sample code would be appreciated.

preguntado el 25 de abril de 13 a las 05:04

use cellvalidating event -

1 Respuestas

Ver

Cómo enlazar DataGridViewComboBoxColumn a un evento OnChange (C #)

Handle the DataGridView's EditControlShowing event

gridview.EditingControlShowing += DataGridViewEditingControlShowingEventHandler(eventHandlerMethod)

then in the eventHandlerMethod handle the object according to it's type, whether that be combobox or text box:

    void eventHandlerMethod(object sender, DataGridViewEditingControlShowingEventArgs e)
    {
        if (e.Control is ComboBox)
        {

        }
        else if (e.Control is TextBox)
        {

        }
    }

contestado el 23 de mayo de 17 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.