La conversión del tipo 'DBNull' en el tipo 'String' no es válida.
Publicado por CHristopher (2 intervenciones) el 23/01/2012 23:52:02
tengo un problema con una resta de celdas en un datagridview oajal me puedan ayudar
Private Sub InventarioDataGridView_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles InventarioDataGridView.CellEndEdit
Dim row As DataGridViewRow = InventarioDataGridView.Rows(e.RowIndex)
Dim Costo As Integer
If Not Int32.TryParse(row.Cells("Costo").Value, Costo) Then
Return
End If
Dim Precio As Integer
If Not Int32.TryParse(row.Cells("Precio").Value, Precio) Then
Return
End If
row.Cells("Ganancia").Value = CStr(Precio - Costo)
End Sub
If Not Int32.TryParse(row.Cells("Costo").Value, Costo) Then aca me marca
InvalidCastException was unhandled
La conversión del tipo 'DBNull' en el tipo 'String' no es válida.
desde ya muchas gracias
Private Sub InventarioDataGridView_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles InventarioDataGridView.CellEndEdit
Dim row As DataGridViewRow = InventarioDataGridView.Rows(e.RowIndex)
Dim Costo As Integer
If Not Int32.TryParse(row.Cells("Costo").Value, Costo) Then
Return
End If
Dim Precio As Integer
If Not Int32.TryParse(row.Cells("Precio").Value, Precio) Then
Return
End If
row.Cells("Ganancia").Value = CStr(Precio - Costo)
End Sub
If Not Int32.TryParse(row.Cells("Costo").Value, Costo) Then aca me marca
InvalidCastException was unhandled
La conversión del tipo 'DBNull' en el tipo 'String' no es válida.
desde ya muchas gracias
Valora esta pregunta


0