473,395 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

help readin text file

So i have a text file where each line represents a button name.

What the code I need to read this file and creatre a new button from
each line..
so far I just have code to read the whole file
Dim TextFileStream As System.IO.TextReade
TextFileStream = System.IO.File.OpenText("C:\MyTextFile.txt")
Dim MyFileContents As String = TextFileStream.ReadToEnd

Nov 24 '06 #1
2 1187
"Marc" <ma*********@hotmail.comschrieb:
So i have a text file where each line represents a button name.

What the code I need to read this file and creatre a new button from
each line..
Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 24 '06 #2
Marc wrote:
<snip>
Dim TextFileStream As System.IO.TextReade
TextFileStream = System.IO.File.OpenText("C:\MyTextFile.txt")
Dim MyFileContents As String = TextFileStream.ReadToEnd
Cool!

You learn a new thing everyday. Having seen System.IO.File.OpenText, I
wondered if there was something like 'ReadToEnd'. And so it has:

Dim Text As String = System.IO.File.ReadAllText(FileName)

or, if you prefer it already split into lines:

Dim Lines() As String = System.IO.File.ReadAllLines(FileName)
Regards,

Branco.

Nov 25 '06 #3

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

Similar topics

2
by: Luis | last post by:
the assignment is to count the number of words in a txt file here is my code #include <iostream> #include <fstream> #include <cassert> using namespace std; int main () {
5
by: Tank | last post by:
I have had this post up here when i was trying to figure out how to make leading zeros and have been able to fudge that to work. I am now have trouble getting the loop that makes the folders to...
6
by: Rylios | last post by:
I am trying to make a very basic text editor using a linked list, fstream, sorting... This is what i have so far...
13
by: Rick | last post by:
The following code will enter an infinate loop when in ReadChars. I can only make it happen when reading a Stream and with this particular XML. If I use the ReadInnerXml call rather than my own...
0
by: huiling25 | last post by:
PDBReader reader1 = new PDBReader(new FileReader("M5250.pdb")); IChemFile content1=(IChemFile)reader1.read((IChemObject)new org.openscience.cdk.ChemFile()); IAtomContainer c1 =...
1
by: belley | last post by:
I have this simple file: ********* <?xml version="1.0" encoding="ISO-8859-1"?> <books:names xmlns:books="http://www.w3.org/1999/xlink"> <book:name xmlns:book="http://www.w3.org/1999/xlink"...
1
by: Poto | last post by:
Hello: i need to read a file line by line because there is diferent information in each line that i need to take out separatly, i'm using the while construction like this while ($file = <FILE>){...
11
by: Victor Lagerkvist | last post by:
Greetings, I know it's usually a bad habit to include several questions in a single message, but they are quite related. I have declared and defined a function named readin, whose purpose is to...
7
by: vinay3744 | last post by:
Hello I am particularly new to programming working on a mathematical analysis where I have to perform some functions on a text file. I have a text file in this format, it contains 3 numbers in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.