Problem converting string to int after spliting.

G

Guest

In one web page, I redirect it to "prtDelReq.aspx?prtindex=0A2A3A8" after the
user click the button.

The prtindex actually contains many integers separated by 'A'.

On the prtDelReq page, I use QueryString("prtindex") to get the value. After
that, I use the Split method to get each integer, something like this:

Dim strItems As String = Request.QueryString("prtindex")
Dim arrItem() As String = strItems.Split("A")
Dim itemno As String

For Each itemno In arrItem

itemno = itemno.Trim
Dim arrIndex As Integer = Integer.Parse(itemno)
resultList.Add(wholeList.Item(arrIndex))

Next itemno

However, error occurs whenever it comes to Integer.Parse(itemno). It always
says that itemno is not in the correct format to convert into an Integer. How
can I resolve this problem?

Thank you in advance.
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top