Visual Basic.NET - Evento cellFormatting en DataGridView

 
Vista:

Evento cellFormatting en DataGridView

Publicado por José (41 intervenciones) el 20/10/2016 17:31:56
Hola,
tengo la version VB2010;
tengo un problema con el evento cellFormatting del DataGridView.
Se como comparar el valor ded una celda del DataGridView con un valor del campo del formulario o un valor fijo. Esto funciona, pero mi problema es el siguiente: tengo un formulario con varios campos y datagridView; en este ActivegDataGrodView tengo una columna EC! y Otra columna EM! yo deseo que cuando la celda EC! tenga el mismo valor Que la celda EM! de la misma fila (de la misma fila), la celda EC! se coloree en rojo; eso es todo.
A ver si me pueden ayudar,;gracias.
José

Private Sub ACTIVEGDataGridView_CellFormatting(sender As System.Object, e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles ACTIVEGDataGridView.CellFormatting
Dim P, Pp As String, Te, Ie, Im As Integer, Tr As Double, Trd As Double
Te = CType(Me.TOPECARTS.Text, Integer) : Tr = CType(Me.TOPREUSITES.Text, Double) : Trd = CType(Me.TOPRENDEMENTS.Text, Double)

P = "R1" : Call FORMATERCEL_RENDEMENTS(e, P, Tr)
P = "R2" : Call FORMATERCEL_RENDEMENTS(e, P, Tr)
P = "R3" : Call FORMATERCEL_RENDEMENTS(e, P, Tr)
'.................................
end sub
Private Sub FORMATERCEL_RENDEMENTS(e As System.Windows.Forms.DataGridViewCellFormattingEventArgs, P As String, R As Double)
If ACTIVEGDataGridView.Columns(e.ColumnIndex).Name = P Then
If e.Value IsNot Nothing And Not IsDBNull(e.Value) Then
Dim Ivalor As Double = CType(e.Value, Double)
If Ivalor > R Then
e.CellStyle.BackColor = Color.LightSkyBlue
End If
End If
End If
End Sub
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

Evento cellFormatting en DataGridView

Publicado por José (41 intervenciones) el 21/10/2016 04:01:24
Hola Edward
y gracias por tu aportación. Me ha servido para lo que necesitaba.
Saludos
José
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
Imágen de perfil de Edward
Val: 392
Bronce
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Evento cellFormatting en DataGridView

Publicado por Edward (146 intervenciones) el 21/10/2016 04:31:29
Buen día para todos,

José un gusto haber podido colaborarte.

Saludos.
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