Take the 2-minute tour ×

I have a text in database which is "computer-hardware". I used that code to split

            ' string seperated by colons '-'
            Dim info As String = strcotegory

            Dim arInfo As String() = New String(3) {}

            ' define which character is seperating fields
            Dim splitter As Char() = {"-"c}

            arInfo = info.Split(splitter)

            For x As Integer = 0 To arInfo.Length - 1
                Response.Write(arInfo(x) & "</br>  ")

but now I want to get "computer" in textbox1 and "hardware" in textbox2.

please guide me

share|improve this question

1 Answer 1

If I understood you correctly, replace the For loop with the following lines of code:

textbox1.Text = arInfo(0)
textbox2.Text = arInfo(1)

By the way, initializing arInfo (... = New String(3) {}) is not necessary, since you overwrite the value of arInfo anyway (arInfo = ...).

share|improve this answer

Your Answer


