search .txt files
search .txt files
search .txt files
search .txt files
search .txt files
search .txt files search .txt files search .txt files search .txt files search .txt files search .txt files search .txt files search .txt files
search .txt files search .txt files
search .txt files
Go Back  Xtreme Visual Basic Talk > > > search .txt files


Reply
 
Thread Tools Display Modes
  #21  
Old 03-20-2005, 06:44 PM
by_m's Avatar
by_m by_m is offline
Contributor
 
Join Date: Jul 2004
Location: Texas
Posts: 661
Default


Sorry, I didn't understsnd the question...what text box? 3, 4 or 5 what?
__________________
170 10101010 410 J31^170
Reply With Quote
  #22  
Old 03-20-2005, 10:25 PM
Talk2Tom11's Avatar
Talk2Tom11 Talk2Tom11 is offline
Centurion
 
Join Date: Dec 2003
Location: Westchester, NY
Posts: 195
Default

I am sorry I wrote it very quickly... What I meant was... I want to know what part of the code needs to be changed in order for me to have the function read the first line of the txt file or the 3, 4, 5. Because right now it is programmed to read the second line in the txt file.
__________________
Ever wonder about those people who spend $2.00 a piece on those little bottles of Evian water? Try spelling Evian backwards: NAIVE.
Reply With Quote
  #23  
Old 03-21-2005, 11:00 AM
by_m's Avatar
by_m by_m is offline
Contributor
 
Join Date: Jul 2004
Location: Texas
Posts: 661
Default

OK, I see, here is an updated version of the SearchByLastName Function...It reads 5 lines, but you can replace the five with a variable or number.
Code:
Public Function SearchByLastName(ByVal fileName As String, ByVal lastName As String) As Boolean Dim streamRead As System.IO.StreamReader 'your stream reader Dim i As Int32 Try If System.IO.File.Exists(fileName) = False Then 'your file doesn't exist... Debug.WriteLine("File '" & fileName & "' doesn't exist.", "SearchByLastName") Return False End If streamRead = New System.IO.StreamReader(fileName) For i = 1 To 5 'Replace with variable or another number representing the number of lines you want to read If streamRead.ReadLine.ToLower = "hello5" Then 'read the next line in the file 'you've found a match Return True Else 'didn't find a match If i = 5 Then Return False 'Again, replace 5 with the variable or number of your choice End If Next Catch ex As Exception Debug.WriteLine(ex.ToString, "SearchByLastName") Return False Finally Call streamRead.Close() End Try End Function
The readline function reads a line, then increments the position of the...little blinky thing you see when you're typing ...to the next line, then when you call readline again, it'll read the line at that position and increment again.
__________________
170 10101010 410 J31^170
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
search .txt files
search .txt files
search .txt files search .txt files
search .txt files
search .txt files
search .txt files search .txt files search .txt files search .txt files search .txt files search .txt files search .txt files
search .txt files
search .txt files
 
search .txt files
search .txt files
 
-->