The conversion of the string "En Cours" to type integer is not valid!!

  • Thread starter Thread starter Bajtitou
  • Start date Start date
B

Bajtitou

Guest
Hi ,

I get this Error "The conversion of the string "En Cours" to type integer is not valid."

When I run this code.


Private Sub Dgw_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles Dgw.CellContentClick

Try
If Dgw.SelectedRows.Count = 0 Then
Exit Sub
End If
Dim dr As Integer = Dgw.CurrentCell.RowIndex + 0
If dr > -1 Then

Cage = CInt(Dgw.Rows(dr).Cells(2).Value)
Race = CStr(Dgw.Rows(dr).Cells(3).Value)
DateDeCouvaison = CDate(Dgw.Rows(dr).Cells(8).Value)
DateMirageŒufs = CDate(Dgw.Rows(dr).Cells(9).Value)
DatedEclosion = CDate(Dgw.Rows(dr).Cells(10).Value)
ŒufsCouvés = CInt(Dgw.Rows(dr).Cells(13).Value)
If IsDBNull(Dgw.Rows(dr).Cells(14).Value) = True Then
ŒufsFécondés = "En Cours"
Else
ŒufsFécondés = CInt(Dgw.Rows(dr).Cells(14).Value)
End If

If IsDBNull(Dgw.Rows(dr).Cells(16).Value) = True Then
ŒufsEclos = "En Cours"
Else
ŒufsEclos = CInt(Dgw.Rows(dr).Cells(16).Value)
End If
If IsDBNull(Dgw.Rows(dr).Cells(21).Value) = True Then
NetSevrés = "En Cours"
Else
NetSevrés = CInt(Dgw.Rows(dr).Cells(21).Value)
End If

If IsDBNull(Dgw.Rows(dr).Cells("Photo").Value) = True Then
frmInfo.PictureInfo.Image = My.Resources.UnUsed
Else
Dim data As Byte() = Dgw.Rows(dr).Cells("Photo").Value
Using ms As New MemoryStream(data)
frmInfo.PictureInfo.Image = Image.FromStream(ms)
End Using
End If
frmInfo.ShowDialog()
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub





The Code Of frmInfo Is :


Private Sub frmInfo_Load(sender As Object, e As EventArgs) Handles MyBase.Load
txtCage.Text = Cage.ToString
txtRace.Text = Race.ToString
txtDateCouvaison.Text = DateDeCouvaison.ToLongDateString()
txtDateMirage.Text = DateMirageŒufs.ToLongDateString()
txtEclosion.Text = DatedEclosion.ToLongDateString()
txtCouvés.Text = ŒufsCouvés.ToString
txtFecondés.Text = ŒufsFécondés.ToString()
txtEclos.Text = ŒufsEclos.ToString()
txtNetSevrés.Text = NetSevrés.ToString()
PictureInfo.Image = PictureInfo.Image

End Sub


So thank you very Much For your Help.

Best Regards .

Continue reading...
 
Back
Top