Imports System
Imports System.IO
Partial Class checkbookingday
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim StrWer As StreamReader
Try
StrWer = File.OpenText(Server.MapPath("File/") & "bookingday.txt") '("D:\user profile\user\Desktop\AirBusBooking\File\bookingday.txt")
Do Until StrWer.EndOfStream
Me.Label1.Text = Me.Label1.Text & StrWer.ReadLine() & "<br>"
Loop
StrWer.Close()
Catch ex As Exception
Me.Label1.Text = "Read failed. (" & ex.Message & ")"
End Try
End Sub
End Class
รบกวนด้วยนะคะ...เพิ่งเคยเขียน.Net ครั้งแรกค่ะ
Tag : .NET, Web (ASP.NET), VB.NET
Date :
2012-07-23 09:37:10
By :
BKAJU1987
View :
1200
Reply :
1
No. 1
Guest
Code (VB.NET)
Imports System
Imports System.IO
Partial Class checkbookingday
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim StrWer As StreamReader
Try
StrWer = File.OpenText(Server.MapPath("File/") & "bookingday.txt") '("D:\user profile\user\Desktop\AirBusBooking\File\bookingday.txt")
Do Until StrWer.EndOfStream
Check(StrWer.ReadLine())
Loop
StrWer.Close()
Catch ex As Exception
Me.Label1.Text = "Read failed. (" & ex.Message & ")"
End Try
End Sub
Protected Function Check(ByVal Text As String) As Boolean
'do something
End Sub
End Class