C sharp - DataGridView

 
Vista:

DataGridView

Publicado por Federico (1 intervención) el 20/08/2018 00:51:12
Buenas tardes, en el evento DoubleClick de un DataGridView tengo el sig codigo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
private void dataListado_DoubleClick(object sender, EventArgs e)
{
    if (dataListado.RowCount != 0)
    {
        this.txtIdventa.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["idventa"].Value);
        this.txtCliente.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["cliente"].Value);
        this.dtpFecha.Value = Convert.ToDateTime(this.dataListado.CurrentRow.Cells["fecha"].Value);
        this.cbComprobante.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["comprobante"].Value);
        this.txtCentro.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["centro"].Value);
        this.txtNumero.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["numero"].Value);
        this.lblTotalVendido.Text = ((decimal)this.dataListado.CurrentRow.Cells["total"].Value).ToString("#,##0.00");
        this.lblTotalPagado.Text = ((decimal)this.dataListado.CurrentRow.Cells["total"].Value).ToString("#,##0.00");
 
        if ((this.cbComprobante.Text == "Venta"))
        {
            this.MostrarDetalleVenta();
            this.MostrarDetallePagos();
            this.tcVentas.SelectedIndex = 1;
            this.txtIdventa.ReadOnly = true;
            this.txtIVA.ReadOnly = true;
        }
        else
        {
            if ((this.cbComprobante.Text == "Anulacion" || this.cbComprobante.Text == "Devolucion"))
            {
                this.MostrarAnulacionVenta();
                this.MostrarDetallePagos();
                this.tcVentas.SelectedIndex = 1;
                this.txtIdventa.ReadOnly = true;
                this.txtIVA.ReadOnly = true;
            }
        }
    }
}
Me encuentro con este problema, cuando realizo por primera vez el dobleclick en alguna fila del DataListado funciona todo el resto del codigo normalmente, ahora selecciono otra fila realizando dobleclick nuevamente para ver los resultados y no copia nada a los TextBox y tampoco me muestra los detalles, pero vuelvo a intentar un dobleclick en la misma fila o en otra y vuelve a funcionar correctamente todo, es decir que hay un intervalo entre un dobleclick a otro, en el medio no realiza nada. Alguien me podria decir cual es el error. Muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 2
Ha aumentado su posición en 48 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

DataGridView

Publicado por AtErNo (1 intervención) el 20/08/2018 16:28:06
Usa DataGridViewCellEventArgs en vez de EventArgs

private void dataListado_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
.....
..
}

Me refiero a que uses el evento CellDoubleClick en vez de DoubleClick
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

DataGridView

Publicado por Federico (1 intervención) el 20/08/2018 17:47:36
Hola, gracias por la ayuda pero en el evento CellDoubleClick sucede lo mismo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

DataGridView

Publicado por juan carlos (2 intervenciones) el 28/10/2018 04:37:34
entra al dgv , solo has doble cclik al dgv y pon eso
1
2
3
4
5
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
    textBox1.Text = dgv.Rows[e.RowIndex].Cells[0].Value.ToString();
    textBox2.Text = dgv.Rows[e.RowIndex].Cells[1].Value.ToString();
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar