Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/05/2011, 04:11
guillebomtrasmiti
 
Fecha de Ingreso: noviembre-2010
Ubicación: madrid
Mensajes: 478
Antigüedad: 13 años, 5 meses
Puntos: 5
Exclamación datagridview valor o no resultado

hola amigos, tengo un problemilla, necesito que si hay datos en un grid, se muestre la información en un textbox y si no hay datos en el grid que se puestre cero, entronces he pensado en hacer esto, pero me suma la cantidad cuando hay datos también me pone cero..alguna ayudita?¿?


Try
Dim total As Decimal = 0

For Each row As DataGridViewRow In DgTotales.Rows

'carga el textbox con el total de lo vendido en el periodo seleccionado
If total = CDec(total + Val(row.Cells(1).Value) * Val(row.Cells(2).Value)) = True Then
Textgrantotal.Text = CStr(total.ToString("#,##0.00€"))
'carga el label con el total de lo vendido en el periodo seleccionado
'LbSumaTotal.Text = CStr(total.ToString("#,##0.00€"))
Else
Textgrantotal.Text = ("#,##0.00€")
End If
Next
Catch
End Try
Textgrantotal.Text = ("#,##0.00€")
End If
Next
Catch
End Try