Click here to Skip to main content
15,897,273 members

Comments by Member 14789896 (Top 6 by date)

Member 14789896 9-Apr-20 10:56am View    
It is done. Apologies I did not accept your solution sooner as I am also new to codeproject.com
Member 14789896 9-Apr-20 10:48am View    
Yes that truly helped me alot! Thank you very much for taking the time to write the code to assist me. I really appreciate it sir
Member 14789896 9-Apr-20 9:51am View    
My mistake, the textbox did create three seperate textboxes. I had to increment the location values in the code below:


' Input string.
Dim value As String = "said shed spread"

' Call Regex.Matches method.
Dim matches As MatchCollection = Regex.Matches(value, "s\w+d")

' Loop over matches.
For Each m As Match In matches

Dim tb As TextBox = New TextBox()

With tb
Dim i As Integer
Dim y As Integer
For i = 1 To 3
y = y + 20
.Location = New Point(12, y)
.Name = String.Concat("TextBox", i.ToString())
.Parent = Me 'this command places textbox on the form!
'other properties

Next

End With

Next


But is there a code to use to add each item value to each textbox? What I am hoping to output is to have three textboxes, with the string "said" in Textbox1, "shed" in Textbox2 and "spread" in Textbox3.
Member 14789896 9-Apr-20 9:23am View    
Deleted
Hang on, perhaps it probably did create three textboxes but put them all in exact positions.
Member 14789896 9-Apr-20 9:13am View    
Thank you for both of you to take the help me but again, I am having problems integrating your code. Right now, I cannot seem to increment the textboxes. This is what I tried but instead of outputting three textboxes, it outputs a single textbox in the default location:


' Input string.
Dim value As String = "said shed spread"

' Call Regex.Matches method.
Dim matches As MatchCollection = Regex.Matches(value, "s\w+d")

' Loop over matches.
For Each m As Match In matches

Dim tb As TextBox = New TextBox()

With tb
Dim i As Integer
For i = 1 To 3
.Name = String.Concat("TextBox", i.ToString())
.Parent = Me 'this command places textbox on the form!
'other properties

Next

End With

Next



Clearly, I am not writing the code the right way. And if I can get it to create three textbox, I still do not know how to make each item store the values in the textboxex; unless its in a listbox like my code in the question.

What I am hoping to output is to have three textboxes, with the string "said" in Textbox1, "shed" in Textbox2 and "spread" in Textbox3. Again, I am a beginner in visual basic and I am asking for help to learn