Determining Textbox Focus

G

Guest

I have two TextBoxes so a user can enter a start and end date using a
calendar control. I am using the <Calendar1_SelectionChanged> method to input
the date in the textbox. My question is this: Is there a way to determine
which textbox has focus so when the the user clicks on a date in the calendar
control, the date selected is inputted into the textbox with focus? Below is
code that I am using.


private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
if(txtStartDate.Text == "")
txtStartDate.Text = Calendar1.SelectedDate.ToShortDateString();

else
txtEndDate.Text = Calendar1.SelectedDate.ToShortDateString();
}


Thanx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top