Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Problem using CTYPe , converting string to integer

I'm basically trying to get a string variable and turn it into an integer but I'm getting this problem at line 46

Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

Source Error:

dim pk as string
Line 44: pk = Session("pk")
Line 45:
Line 46: Dim pkInt As Integer = CType(pk, Integer)
Line 47:
Line 48:
[685 byte] By [Matrix.net] at [2007-11-11 10:31:39]
# 1 Re: Problem using CTYPe , converting string to integer
What is the value of pk when you get the error?
Phil Weber at 2007-11-11 23:11:48 >
# 2 Re: Problem using CTYPe , converting string to integer
What is the value of pk when you get the error?

thanks for the tip Phil , that helped . I checked what it was for PK before it went to the page but not when it got to the page itself and now that I did , I just found my problem . Thanks ! :D
Matrix.net at 2007-11-11 23:12:44 >