On Nov 20, 12:02*am, "Gregory Leck" <gregoryl...@vi deotron.cawrote :
I can import a .txt document into a TextBox
Each line in the TextBox contains a URL, for example,http://www.whateverdomain.com
I would like to convert each URL to the following format:
<a href="http://www.whateverdom ain.com">http://www.whateverdom ain.com</a>
Obviously I'm a dumb noob. I know how to convert a single line of text but can't figure out how to treat line-by-line, multiple entries in a TextBox..
Thanks in advance for your suggestions.
Hi Gregory,
Textbox control has Lines() property which returns all the lines
located in textbox. So, you can convert all the lines (lines, which
represent URLs) using with another array(myurlarr) as follows:
' Assuming you have pure URLs line by line in TextBox1
' The core of the job
Dim myurlarr() As String
myurlarr = TextBox1.Lines
For x As Integer = 0 To myurlarr.Length - 1
myurlarr(x) = "<a href=" & """" & TextBox1.Lines( x) & _
"""" & ">" & TextBox1.Lines( x) & "</a>"
Next
' Optionally, you may want to see converted output
For x As Integer = 0 To myurlarr.Length - 1
MsgBox(myurlarr (x).ToString)
Next
I tested the code that i wrote and i hope it'll work for you,
Onur Güzel