Dim subString As String() = Nothing
subString = textBox.Text.Split(" ") 
searchSource.SelectParameters.Item("ContentText0").DefaultValue = subString(0)
searchSource.SelectParameters.Item("ContentText1").DefaultValue = subString(1)

Here's what i'm trying to do. So if I two words put into the textBox, this will work. But I'm really not sure how to modify this so it can fit the situations when there is only ONE word in the textBox, since the subString(1) doesn't exist.

I'm really green to this. Thank you for your help!

Q

use after split

For i as Integer = 0 To subString.Count - 1
  searchSource.SelectParameters.Item("ContentText" + i).DefaultValue = subString(i)
Next

Thank you~

I also find UBound() is useful for this kind of thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.