Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/04/2008, 16:21
Javiher
 
Fecha de Ingreso: abril-2008
Mensajes: 1
Antigüedad: 16 años, 1 mes
Puntos: 0
Modificar contenido en Dataview

Necesito ayuda, les agradesco de antemano en lo que me puedan ayudar.

Tengo este codigo en un evento y quiero que cuando me selecciona los registros por ese parametro sGeneroParametro , esos registros que han sido seleccionados me cambie el contenido de sus campos, o sea si la filtracion es en la columna uno, y se filtra por sGeneroParametro = "Javiher", en tonces me muestre esos registros, hasta aqui ya hace eso, pero quiero que esos regitros que dicen Javiher me lo cambie por Manuel, u otro contenido.

dgvGenero es un datagrid y dataViewPatologia es la vista de otro datagrid, no del mismo. Si hay una forma de actualizar los datos de un datavien me avisan, no tiene que ser resuelto de la manera en que lo planteo. Gracias de antemano.

sGenero = (string)generoFamiliaDS.utlGenero[utlGeneroBindingSource.Position].Gen_genero;
sGeneroParametro = sGenero;
DataView dataViewPatologia = generoFamiliaDS.Tables["utlPatologia"].DefaultView;
dataViewPatologia.RowFilter = "Pat_genero = " + "'" + sGeneroParametro + "'";
dgvPatologia.DataSource = dataViewPatologia;




private void dgvGenero_CellEnter(object sender, DataGridViewCellEventArgs e)
{
SeleccionRegistro();
}

private void dgvGenero_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
SeleccionRegistro();
}

private void SeleccionRegistro()
{
if (nPosicionGenero <= nRegistrosGenero)
{
try
{
sGenero = (string)generoFamiliaDS.utlGenero[utlGeneroBindingSource.Position].Gen_genero;
sGeneroParametro = sGenero;
DataView dataViewPatologia = generoFamiliaDS.Tables["utlPatologia"].DefaultView;
dataViewPatologia.RowFilter = "Pat_genero = " + "'" + sGeneroParametro + "'";
dgvPatologia.DataSource = dataViewPatologia;
}
}
}


Este codigo de abajo lo uso para cambiar los datos en el datagrid y lo hace bien. El problema es que cuando se ejecuta el Evento CellEnter no lo hace, si comentamos la linea del evento CellEnter hace lo que quiero, pero si no esta ejecuta esa linea y la primer fila del datagrid no se almacena.

private void dgvGenero_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
nCounter = 0;
sGenero = (string)generoFamiliaDS.utlGenero[utlGeneroBindingSource.Position].Gen_genero;
sGeneroActual = sGenero;
//MessageBox.Show(Convert.ToString(dgvPatologia.RowC ount));
//MessageBox.Show(sGeneroParametro);
//MessageBox.Show(sGeneroActual);
if (sGeneroActual != sGeneroParametro)
{
DataView dataViewPatologia = generoFamiliaDS.Tables["utlPatologia"].DefaultView;
dgvPatologia.Rows[0].Cells[0].Value = sGeneroActual;
foreach (DataRowView dataRowActual in dataViewPatologia)
{
dgvPatologia.Rows[0].Cells[0].Value = sGeneroActual;
dgvPatologia.Rows[1].Cells[0].Value = sGeneroActual;
}
//dgvPatologia.Rows[1].Selected = true;
SendKeys.Send("{TAB}{TAB}{TAB}");
}
SendKeys.Send("{TAB}{TAB}{TAB}");
}

Última edición por Javiher; 17/04/2008 a las 17:01 Razón: Explicando mejor y agregando mas codigo