Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by miejan
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...