﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>A1VBCode Forums / Visual Basic .NET / .NET Programming (VB 2010 or earlier)  / Reading a Multi-line Text file / Latest Posts</title><generator>InstantForum.NET v4.1.1</generator><description>A1VBCode Forums</description><link>http://www.a1vbcode.com/vbforums/</link><webMaster>forums@a1vbcode.com</webMaster><lastBuildDate>Wed, 08 Feb 2012 23:37:21 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Reading a Multi-line Text file</title><link>http://www.a1vbcode.com/vbforums/Topic27803-9-1.aspx</link><description>First, the Split() function is great for separating strings at a delimiter. Use this when you're assigning the ReadLine() value to namein&lt;/P&gt;&lt;P&gt;Also, you'll only read the top line of your text file. You'll want to use a loop like this:&lt;/P&gt;&lt;P&gt;Do Until EOF(1)&lt;/P&gt;&lt;P&gt;Read...&lt;/P&gt;&lt;P&gt;Loop&lt;/P&gt;&lt;P&gt;"1" would be the integer you assign to a file using the FileOpen function, which in your case I would advise you use. &lt;/P&gt;&lt;P&gt;Lastly, for formatting, use Mark's tool. Most A1 gods and gurus do:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.a1vbcode.com/a1vbcode/vbforums/Attachment30.aspx"&gt;http://www.a1vbcode.com/a1vbcode/vbforums/Attachment30.aspx&lt;/A&gt;</description><pubDate>Mon, 29 Jun 2009 15:54:43 GMT</pubDate><dc:creator>Mobius</dc:creator></item><item><title>RE: Reading a Multi-line Text file</title><link>http://www.a1vbcode.com/vbforums/Topic27803-9-1.aspx</link><description>Is the data on each line delimited by a space or comma? How about reading in the entire line and then filter out the number using the .substring and .IndexOf&lt;FONT face="Courier New" color=#000000&gt; &lt;/FONT&gt;methods?&lt;/P&gt;&lt;P&gt;&lt;SPAN class=inlinecode&gt;&lt;FONT face="Courier New" color=#000000&gt;strName = strInput.Substring(0, strInput.IndexOf(",")) 'assuming data separated by comma&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;</description><pubDate>Thu, 18 Jun 2009 12:09:19 GMT</pubDate><dc:creator>TBone</dc:creator></item><item><title>Reading a Multi-line Text file</title><link>http://www.a1vbcode.com/vbforums/Topic27803-9-1.aspx</link><description>Hi A1 forums,&lt;br&gt;&lt;br&gt;I've got a small issue with a program I'm working on.  In a nutshell, the user enters two values, their name and a number.  Those values are written to a text file.  I want it to then be able to have the user re-enter their name, and have it check for said name in the text file.  The code I have so far works...somewhat.&lt;br&gt;&lt;br&gt;(I apologize for the bad formatting, if there's any way for me to make it a little less Wall-of-Texty I'll be happy to edit my post)&lt;br&gt;&lt;br&gt;        read = File.OpenText("Codes.txt")&lt;br&gt;&lt;br&gt;        name1 = InputBox("Enter your name.", "Name")&lt;br&gt;        &lt;b&gt;namein = read.ReadLine()&lt;/b&gt;&lt;br&gt;&lt;br&gt;        If namein.ToUpper &lt;&gt; name1.ToUpper And tf = False Then&lt;br&gt;            namein = read.ReadLine()&lt;br&gt;            MessageBox.Show(namein &amp; " " &amp; pass, "Debug box", MessageBoxButtons.OK)&lt;br&gt;        ElseIf namein.ToUpper = name1.ToUpper Then&lt;br&gt;            pass = CInt(read.ReadLine())&lt;br&gt;            passin = InputBox("Enter your password.", "Enter")&lt;br&gt;            If pass = passin Then&lt;br&gt;                MessageBox.Show("Password Verified.", "Password")&lt;br&gt;            Else&lt;br&gt;                MessageBox.Show("Password Incorrect, please try again.", "Password Error.", MessageBoxButtons.OK)&lt;br&gt;            End If&lt;br&gt;            MessageBox.Show(namein &amp; " " &amp; pass, "Debug box", MessageBoxButtons.OK)&lt;br&gt;        End If&lt;br&gt;&lt;br&gt;For the sake of an argument "Codes.txt" contains the following line of text:&lt;br&gt;&lt;br&gt;Bob, 12.5&lt;br&gt;&lt;br&gt;My main issue is separating the "Bob" and "12.5" as right now the code is bringing the entire line in as a variable (line in bold).  Is there any way for me to separate the name and the code?  Thanks a ton for any help that you can give &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Smile.gif" border="0" title="Smile"&gt;</description><pubDate>Tue, 16 Jun 2009 18:05:18 GMT</pubDate><dc:creator>Freedfromthereal</dc:creator></item></channel></rss>
