lo mejor para esto, es usar el evento EditingControlShowing asociado al datagridview
Código:
private void dgvMiDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
try
{
TextBox Tbx = e.Control as TextBox;
ComboBox Cbx = e.Control as ComboBox;
if (Cbx != null)
{
Cbx.Validated -= new EventHandler(Cbx_ValidaIngresoComboBox);
Cbx.Validated += new EventHandler(Cbx_ValidaIngresoComboBox);
}
if (Tbx != null)
{
Tbx.Validated -= new EventHandler(Tbx_ValidaIngresoTexto);
Tbx.Validated += new EventHandler(Tbx_ValidaIngresoTexto);
}
}
catch (Exception)
{
throw;
}
}
luego te creas las funciones que validan los datos tanto del combobox como del textbox
Código:
private void Tbx_ValidaIngresoTexto(object sender, EventArgs e)
{
try
{
#region Obtiene Valores
string sValorVariable = ((TextBox)sender).Text.Trim();
int iFilaEditada = dgvMiDataGridView.CurrentRow.Index;
el resto de tu codigo....
}
}
Plch