If i have three textboxes in my vb.net webform ..
Textbox1.text="Sumit"
Textbox2.text="4-Dec-2010"
Textbox3.text="1-Jan-2011"
I want if dates selected are in between textbox2 dates and textbox3 dates then textbox1.text="sumit" else tex开发者_高级运维tbox1.text="No dates"
Put the following in your TextChanged method of your textboxes. Set Textbox1.Text = CheckDates().
Function CheckDates
'Checks to make sure dates were entered'
If Not IsDate(Textbox2.text) or Not IsDate(Textbox3.text) Then
Return "No Dates"
Exit Function
End If
If CType(Textbox2.text,Date) >= #12/4/2010# and CType(Textbox3.text,Date) <= #1/1/2011# then
Return "Submit"
Else
Return "No Dates"
End If
End Function
精彩评论