Format problem...

G

Guest

Can someone please tell me why I might be getting the following error!

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:
Line 76: Sub DGPages_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Line 77: 'Read in the values of the updated row
Line 78: Dim pageID As Integer = e.Item.Cells(1).Text ' Error line
Line 79: Dim modificationDate As Double = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Line 80: Dim description As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text

...:: CODE
 
S

Shiva

Hi,

e.Item.Cells(3).Text returns your a string. So, to assign it to a Integer,
use Int32.Parse() or set Option Strict Off. In either case, make sure, you
get a valid value (that can be converted as integer) for
e.Item.Cells(3).Text

HTH.

"Tim::.." <myatix_at_hotmail.com> wrote in message
Can someone please tell me why I might be getting the following error!

Exception Details: System.FormatException: Input string was not in a correct
format.

Source Error:
Line 76: Sub DGPages_Update(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Line 77: 'Read in the values of the updated row
Line 78: Dim pageID As Integer = e.Item.Cells(1).Text ' Error line
Line 79: Dim modificationDate As Double =
CType(e.Item.Cells(2).Controls(0), TextBox).Text
Line 80: Dim description As String =
CType(e.Item.Cells(3).Controls(0), TextBox).Text

...:: CODE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top