Click here to Skip to main content
15,900,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to set a focus to the text box when the error throws. I am using calling this class from some other class.Here is the code
public string CustomerSubmission
    {
        get
        {
            return _customerSubmission;
        }
        set
        {
            try
            {
                DateTime CustomerSubmission = Convert.ToDateTime(UserUtil.ConvertDate(value.ToString().Trim()));
                if (value.ToString().Trim() == "")
                {
                    throw new Exception(Message.Blank("Customer Submission Date"));                    
                    
                }
                else if (!UserUtil.IsDateinDDMMYYYYFormat(value))
                {
                    throw new Exception(Message.InvalidDate("Customer SubmissionDate"));
                }
                else if (CustomerSubmission > DateTime.Now)
                {
                    throw new Exception(Message.DateShouldBeLessThan("Customer Submission Date"));
                }   
                _customerSubmission =  UserUtil.ConvertDate(value.ToString().Trim());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }


Thanks in advance
Posted
Comments
[no name] 4-Aug-11 3:39am    
is it windows or ASP.net??

1 solution

Try the TextBox.Focus method - if this is Winforms then it will work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900