15,897,273 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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
Member 14789896
9-Apr-20 2:12am
View
@losmac Thank you for your comment. I am a beginner in visual basic and I am trying to integrate your textbox loop with the code I have but I am unable to. Can you please help me? Below there is a matches function code that would output the string "said shed spread" in a listbox. May you integrate your code in this one so it would output "said" in Textbox1, "shed" in Textbox2 and "spread" in Textbox3?
' 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
ListBox1.Items.Add(m.Value)
Next
Show More