tags:

views:

57

answers:

2

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>  ")
            Next

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

please guide me

+5  A: 

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 = ...).

Heinzi
A: 

Thanks its working

mustafa