Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data dynamics Active Reports Report Designer 3.0 string

Status
Not open for further replies.

neato

Programmer
Sep 14, 2009
2
US
Hi,

I am creating a form in ActiveReports. I use VB.net. Not C# in in the script. I need to break a string that is seperated by ";". It has to be broken down and entered into other text fields.

The data is entered into a Question/answer field so I don't know the data, type or length that will be entered. The users are told to seperate each description by ";". I do know there can be up to four ";". No more than four and all four might not be used.

an example:
Programming;is;great;fun;always

Programming would populate textbox1
is-textbox2
great-textbox3
fun-textbox4
always-textbox5

I appreciate any help. My backgroud mainly is Access database using VBA, SQL Server databases and VB 6.0. I have been working with ActiveReports for a few months and up to now have been able to figure things out. In Access I used recordsets for almost everything.


 

Use the String.Split method:

Dim MyArray() As String
Dim strAnswers As String

strAnswers = TextBox1.Text

MyArray = strAnswers.Split(";")


That last line splits the string on the semicolon. Using your example above, you would have:

MyArray(0) -> "Programming"
MyArray(1) -> "is"
MyArray(2) -> "great"
MyArray(3) -> "fun"
MyArray(4) -> "always"

You can populate your textboxes from the array.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thank you. I didn't realize the split method could be used in VB.net script in ActiveReports. I'll give this a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top