473,662 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading TextBox info line by line

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.
Nov 19 '08 #1
3 6042
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

Nov 19 '08 #2
For Each S As String In Split(TextBox1. Text, vbCrLf)
<process S>
Next

"Gregory Leck" <gr*********@vi deotron.cawrote in message
news:OP******** ******@TK2MSFTN GP02.phx.gbl...
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.

Nov 20 '08 #3
Thanks for that. It works great. I guess I need to learn more about arrays before I get too ambitious!

***
"Gregory Leck" <gr*********@vi deotron.cawrote in message news:OP******** ******@TK2MSFTN GP02.phx.gbl...
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.
Nov 20 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
31347
by: Simon | last post by:
Using qbasic, the following accepts input from com1, and prints its output : OPEN "com1:9600,n,8,1,CD0,CS0,DS0,RS" FOR INPUT AS #1 WHILE INKEY$ <> " " INPUT #1, a$ PRINT a$ WEND What would the same set of commands look like in VB. I am reading the
6
16860
by: David Gray | last post by:
Greetings all, I'm working on a program that allows a user to enter notes in a multiline textbox. I would like to be able to read the contents of the textbox (as records - one per line) and store in an array then a file. Perhaps this is the wrong control to use as there seems no way of referencing each line of the text box.
6
12726
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
10
3543
by: Alex | last post by:
could someone please point me to a site with an explanation or give me a *very* simple example of a div that would open right below a textbox on a page. I've seen lots of examples out there. Unfortunately I don't have time right now to dig through that code to extract the basic functionality. The one implementation that really hits the spot can be found here: http://www.eworldui.net/CustomControls/CalendarPopupDemo.aspx look at the...
20
3055
by: ishmael4 | last post by:
hello everyone! i have a problem with reading from binary file. i was googling and searching, but i just cant understand, why isnt this code working. i could use any help. here's the source code: --cut here-- typedef struct pkg_ { short int info; char* data;
3
6082
by: James Tunic | last post by:
I am trying to write a program (in C) for reading grid1.dat and grid2.dat and displaying the data it has read on the screen. I have got as far as the program listed below, it seems to compile fine but doesn't seem to read correctly as most of the time a runtime error occurs. I 'm also unsure how to implement the fprintf statement to get the data to be displayed on the screen.
1
1567
by: Mr. B | last post by:
VB.net 2003 c/w Framework 1.1 and MS Access db We have a commercial program that does our Acounting and Time Sheets (Timberline). At least once a day our Accounting department runs a Script file that Exports info into an MS Access db file and which has 7 Tables (stuff like Project info, Project numbers, User names, etc). I wrote a Time Sheet entry application to read this info and to allow Employees to write their Time Sheet data into...
1
1458
by: Developer | last post by:
VC++ 2005 Express Edition: I have a textBox with the properties: this->m_TextBox_Desc->Multiline = true; this->m_TextBox_Desc->WordWrap = true; this->m_TextBox_Desc->ScrollBars = ScrollBars::Vertical; I read my database with a description for the user. I want to load each line into a listView. With wordWrap and the Width of the textBox gives
3
1801
by: lizii | last post by:
i have a file - which on each line has some data i need to fill into a box - now although reading in the data is simple enough and putting it in the correct box will be no problem, as i can just read a lilne then put into the corresponding box...it just seems like a task i should be able to complete in a few lines...rather than quite a few commands. for example what i do at the moment is: read a line place into first text box
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.