Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
searchmounthnow()
searchyearnow()
lstMount.Text =""
lstMount.Text =""
End Sub
Protected Sub searchmounthnow()
Dim Month As Integer = Now.Month
lstMount.Text = Month
End Sub
Protected Sub searchyearnow()
Dim Year As Integer = Now.Year
lstSearchYear.Text = Year
End Sub
Protected Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click
CalculateDate()
..........................................................
........................
end sub
Protected Sub CalculateDate()
If lstBlackmount.Text = "3 เดือน" Then
Try
Dim STdate As New DateTime(lstSearchYear.Text, lstMount.Text, 1)
Dim Stdate2 As String = DateTime.Parse(STdate.ToString).AddMonths(1).AddDays(-1).ToString("dd/MM/yyyy")
lblSTdate.Text = Stdate2.ToString
Dim ENdate As String = DateTime.Parse(STdate.ToString).AddMonths(-2).ToString("dd/MM/yyyy")
lblENdate.Text = ENdate.ToString
lblTo.Text = ("------ย้อนไปถึงวันที่----------")
Catch ex As SqlException
Response.Write(ex.Message.ToString())
End Try
End If
end sub