C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Correct the Error??


Posted Date: 30 Sep 2008      Posted By: Ravi Kiran.T      Member Level: Gold     Points: 1   Responses: 1



if(calEndDate.SelectedDate >= calStartDate.SelectedDate)
{
lblResConf.Text="A room is available."+_
"Your Reservation Details are: <p>"+_
"Room Type:" + 1stroomType1.SelectedItem.Text+_
"<br>"+1stroomtype2.SelectedItem.Text+_
"<br>From:"+_
calStartDate.SelectedDate.ToShortString()+_
"<br>To:"+_
calStartDate.SelectedDate.ToShortString();
}
else
{
lblResConf.Text="Reservation Error!The"+_
"Ending date must be after starting date";



The code referenced above results in a compile error. Which one of the following corrects the error?
Choice 1
Change SelectedDate to DateSelected.
Choice 2
Change ToShortString() to ToShortDateString().
Choice 3
Change >= to <=.
Choice 4
Include an End Else.
Choice 5
Change the Else to Else If.






Responses

Author: Prafulla S Shimpi    30 Sep 2008Member Level: GoldRating: 3 out of 53 out of 53 out of 5     Points: 3

if(calEndDate.SelectedDate >= calStartDate.SelectedDate)
{
lblResConf.Text="A room is available."+_
"Your Reservation Details are: <p>"+_
"Room Type:" + 1stroomType1.SelectedItem.Text+_
"<br>"+1stroomtype2.SelectedItem.Text+_
"<br>From:"+_
calStartDate.SelectedDate.ToShortString()+_
"<br>To:"+_
calStartDate.SelectedDate.ToShortString();
}
else
{
lblResConf.Text="Reservation Error!The"+_
"Ending date must be after starting date";


Answer is:


Choice 2
Change ToShortString() to ToShortDateString().


please correct me i I am wrong



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : how can i get datakeynames in selected index changed
Previous : Log Analysis Tool
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use