Module Module1
'This can use to read list of names in a text file
Sub Main()
Dim txt As String
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
oRead = oFile.OpenText("C:\sample.txt")
While Not oRead.EndOfStream
'do whatever you want to do
txt = oRead.ReadLine()
Console.WriteLine(txt)
'read text input charactor to be compare
Dim compChar As Char()
compChar = "d"
If compChar = txt.Substring(0, 1) Then
Console.Write("Charactor Found : " & txt)
Console.WriteLine("")
End If
End While
oRead.Close()
Console.ReadKey()
End Sub
End Module
'-------------- Out put ---------------Sample text in sample.txt
Ruwan
daya
Kamal
jagath
Nimal
Rasika
Manoj
No comments:
Post a Comment