Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/01/2009, 07:45
javiercapi
 
Fecha de Ingreso: agosto-2005
Mensajes: 33
Antigüedad: 18 años, 9 meses
Puntos: 0
Respuesta: Realizar Operacion dentro de un DataGridView

Lo normal es que ese campo se complete sin necesidad de un boton, agregando el codigo al evento CellValueChanged de tu datagridview, algo asi

Código PHP:
       If DataGridView1.Rows.Count 1 Then
            
If e.ColumnIndex 0 Then 'index del campo cantidad
                DataGridView1.Rows(e.RowIndex).Cells("SubTotal").Value = DataGridView1.Rows(e.RowIndex).Cells("Cantidad").Value * DataGridView1.Rows(e.RowIndex).Cells("Precio").Value
            ElseIf e.ColumnIndex = 1 Then '
index del campo precio
                DataGridView1
.Rows(e.RowIndex).Cells("SubTotal").Value DataGridView1.Rows(e.RowIndex).Cells("Cantidad").Value DataGridView1.Rows(e.RowIndex).Cells("Precio").Value
            End 
If
        
End If 
Pero si lo que quieres es hacerlo por un boton, agregas esto al evento click del boton

Código PHP:
 For As Integer 0 To DataGridView1.Rows.Count 2
            DataGridView1
.Rows(i).Cells("SubTotal").Value DataGridView1.Rows(i).Cells("Cantidad").Value DataGridView1.Rows(i).Cells("Precio").Value
        Next