Click here to Skip to main content
13,258,479 members (54,093 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 2 Feb 2012
Copyright © CodeProject, 1999-2017
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