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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script - Multiline Textbox

Status
Not open for further replies.

Electro121

Technical User
Oct 19, 2002
51
CA
Hi All,

I am very new to VB Script and trying to figure out what is probably a simple issue but can't seem to get the result I want.

I have a small form I have created with 2 multiline text boxes on the left and right hand sides of the form and a couple of buttons.

When I click a button, I want to take the data from each line in one textbox, add a fixed string of data to each line of the textbox on the left, and then output the data to the right hand side textbox.

For example:

Texbox1 - Data entered on separate lines
123
456
789

When button is clicked, add a fixed string of data to each line

Textbox 2 Output:
This is my data - 123
This is my data - 456
This is my data - 789


There are an unknown number of lines in each textbox (could be 10 lines, or could be thousands of lines). The script should be able to accommodate a random number of lines as the textbox1 input will be different all the time.

My script as follows:

Private Sub Block_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Block.Click
Dim Countme As Integer
While Countme < (Textbox1.Lines.Count())
Countme = Countme + 1
Dim sb1(Textbox1.Lines.Count()) As String
sb1(Textbox1.Lines.Count()) = "This is my data" & " " & Textbox1.Text
Textbox2.Text = sb1(Textbox1.Lines.Count())
End While
End Sub



The first line seems to work correctly but subsequent lines only show the original input and not the added string data + original input in the second textbox.

Any help would be greatly appreciated.

Thanks!
Darryl
 
This appears to be VB.NET. If so, you would be better off reposting in this forum: forum796
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top