v
Not logged inv
SearchAsk a QuestionReport an IssueMake a SuggestionMy Questions and Issues
Issue Details
Find By ID

EditMask Not Validating When Setting EditValue In Code

Issue Details

Log in to Track Changes or Edit
Q207580
Question
Joseph Jackson
Yes
Processed
Answered
.NET
XtraEditors Library
8.3.2
Windows Vista
Microsoft Visual Studio 2008
6/2/2009 7:58:04 PM
-> Created by Joseph Jackson 5/29/2009 5:25:03 PM

Hi, I have a custom email control that inherits from the buttonedit. I set the editmask and masktype in code and expose a public emailaddresss string property that sets the editvalue for the control. Everything works fine when I start typing in the control, it will not let me leave if their is an invalid value in the editor. My problem is, if I set the emailaddress property value at runtime from the main form, I can input an invalid email address and the control will allow the value without raising an error. I can even focus the control and leave it and it will not say it is invalid. It is only when I begin to type in the editor that it validates it. What do I need to do to get this to work? I'm sure it is something simple I am overlooking.

<- Processed (Duplicate : DQ7266) by DevExpress Team 5/29/2009 6:44:50 PM

Hi Joseph,

We have answered a similar issue in the testing the validity of a proposed value with a TextEdit's Mask property thread.

Thanks,
Plato

--------------------
Check if Search Engine is able to answer questions faster than I do!

-> Reactivated by Joseph Jackson 5/29/2009 7:39:53 PM

Thanks for the quick reply! I did look at that post before submitting this question and I didn't think that it provided me with what I needed. One thing I left out in my original post was that I need the error icon to display if the value doesn't match the editmask. When I run the program, I the emailaddresscontrol is on the form and from the main form I can set the emailaddresscontrol.EmailAddress property to an invalid value ("testemail@ee") and it will except this value and not show the error icon until I begin typing into the control and try to leave it. How do I accomplish this?

<- Processed (Answered) by DevExpress Team 6/1/2009 4:44:21 PM

Hi Joseph,

The following code should work fine for you:

        private void simpleButton1_Click(object sender, EventArgs e) {
            textEdit1.Select();
            textEdit1.EditValue = "SomeValue";
            textEdit1.DoValidate();
        }

        private void textEdit1_Validating(object sender, CancelEventArgs e) {
            e.Cancel = !IsEditValueMatch;
        }

Thanks,
Plato

-> Reactivated by Joseph Jackson 6/1/2009 6:35:43 PM

Thanks! That solved my problem.

<- Processed (Answered) by DevExpress Team 6/1/2009 6:59:49 PM

You are always welcome, Joseph :)

Thanks,
Plato

<- Processed (Customer Closed) by Joseph Jackson 6/2/2009 7:58:04 PM
Log in to Track Changes or Edit

Peer-to-Peer Discussion in DevExpress Forums

No discussion on this article has been started yet.

Please login to start discussion.

v
v
Search
Searching Tips