Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
hai ,
how to search a particular words in text file using vb.net
Posted 2-Feb-12 0:36am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Read a chunk of the text file, for instance a line, into a String object and then use the String.IndexOf method.
  Permalink  
Comments
Amir Mahfoozi at 2-Feb-12 5:45am
   
+5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Use this code to find specific word in text file
 
Dim InputStr As String = TextBox1.Text
 
        For Each FileStr As String In IO.Directory.GetFiles("C:\your folder", "*.txt")
 
            If IO.File.ReadAllText(FileStr).IndexOf(InputStr) >= 0 Then
 
                ListBox1.Items.Add(IO.Path.GetFileName(FileStr))
 
            End If
 
        Next
 
Thanks
SP
  Permalink  
Comments
byank at 18-Jul-12 8:34am
   
How to write this in visual c++?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,065
1 DamithSL 4,989
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,547
4 Kornfeld Eliyahu Peter 4,314


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 2 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100