Extracting Data from a Text file to Label in ASP.Net
Private Sub lnkBut1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkBut1.Click
' Dim file_name As String
file_name = "News1.txt" \specify the text file[this is only for a text file]
Dim fs As New FileStream(Server.MapPath(file_name), FileMode.Open, FileAccess.Read)
Dim objreader As New StreamReader(fs)
lblText.Text = "" \pasting the test data to a Label
While (objreader.Peek() > -1)
lblText.Text += objreader.ReadLine
End While
fs.Close()
End Sub
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home