miejan Posted March 11, 2005 Posted March 11, 2005 (edited) I have 3 dropdownlists..having day, month and year respectively. When the page first load, the current date will appear.But when I do the selection, like choosing randomly for other date,nothing comes out when I click the Ok button; it does not trigger the selected value. --- If Issue_Month.SelectedValue = 2 Then If Issue_Day.SelectedValue = 29 Or Issue_Day.SelectedValue = 30 Or Issue_Day.SelectedValue = 31 Then strIssueDate = Issue_Month.SelectedValue & "/28/" & Issue_Year.SelectedValue End If Else strIssueDate = Issue_Month.SelectedValue & "/" & Issue_Day.SelectedValue & "/" & Issue_Year.SelectedValue End If If ReturnedDate_Month.SelectedValue = 2 Then If ReturnedDate_Day.SelectedValue = 29 Or ReturnedDate_Day.SelectedValue = 30 Or ReturnedDate_Day.SelectedValue = 31 Then strReturnDate = ReturnedDate_Month.SelectedValue & "/28/" & ReturnedDate_Year.SelectedValue End If Else strReturnDate = ReturnedDate_Month.SelectedValue & "/" & ReturnedDate_Day.SelectedValue & "/" & ReturnedDate_Year.SelectedValue End If lbl1.Text=strReturnDate lbl2.Text=strIssueDate ---------- Anyone has the idea on this? Edited March 11, 2005 by miejan Quote
penfold69 Posted March 11, 2005 Posted March 11, 2005 A slightly neater way of doing this. Try Dim dIssue As New Date(Issue_Year.SelectedValue, Issue_Month.SelectedValue, Issue_Day.SelectedValue) Dim dReturned As New Date(ReturnedDate_Year.SelectedValue, ReturnedDate_Month.SelectedValue, ReturnedDate_Day.SelectedValue) lbl1.Text = dReturned.ToShortDateString() lbl2.Text = dIssue.ToShortDateString() Catch Ex as ArgumentOutOfRangeException ' Information input was invalid date - eg 31/02/2004 Catch Ex As Exception ' Some other problem End Try B. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.