Hi,
Could anyone help me out to find a solution for the below description?
I have a combo editor in my windows application and I want to find whether a word which is not supposed to be there is present.
Note, this editor has already set as a mandatory one in the property tab with other regex and message. So i will have to use this again based on a condition for example, while saving the form. So, I will use something like this
county = countyIdUltraCombo.Text.Replace(" ", "").ToString().ToUpper(); --> code to get the sting value by removing space in between
Once I get this string value, i will use it in a if condition to get into the loop and execute the below.
infragisticsErrorProvider1.SetRegexPattern(addressControl1.countyIdUltraCombo, "^(?!OFFLINE$|OFF LINE$|offline$|Offline$|oFFLINE$|oFF LINE$|Off Line$).+"); infragisticsErrorProvider1.SetRegexMessage(addressControl1.countyIdUltraCombo, "Offline is not valid"); infragisticsErrorProvider1.SetValidationEnabled(addressControl1.countyIdUltraCombo, true);
The issue is we can keep adding different arrangement of the word offline in order to make the regexpattern work, like one mentioned above.
Kindly advise how to use this effectively so that all kinds of the word offline can be a pattern.
Thanks
Preeth
Coorection, I meant different arrangements of the word Offline.
Examples are Offline, Off line,OFFLINE, OFF Line, OFF LINE, oFFLINE, Off Line, OFF L I N E, etc
Hello Preeth,
Thank you for posting in our forum.
If I understand you correctly you need a RegEx pattern which will match every possible way you may wright the word “OFFLINE”, including different spaces added around the characters of the word, and different casing of each character. One possible pattern could be this one:
[\s]*[Oo][\s]*([Ff][\s]*){2}[Ll][\s]*[Ii][\s]*[Nn][\s]*[Ee][\s]*
Please check this patter, and let me know if this is what you are looking for or if I am missing something.
Hi Milko,
Thanks for this. Could you kindly advise whether this is how it should be?
nearestCityIdUltraCombo, "^(?[\s]*[Oo][\s]*([Ff][\s]*){2}[Ll][\s]*[Ii][\s]*[Nn][\s]*[Ee][\s]*).+")
As it shows that 's' is an unspecified escape sequence.
Hi Preeth,
Thank you for your feedback.
If you are not able to send me a sample reproducing this behavior, what I can do is try to implement one. However I will need some additional information to be able to create such sample. So please, answer the below questions:
Which Infragistics controls are you using in your application? From the title of your thread is seems that you are using UltraComboEditor. Is this correct? What types are infragisticsErrorProvider1 and addressControl1?
What you mean by “…this editor has already set as a mandatory one in the property tab…”? Please note, UltraComboEditor has no such property as Mandatory. If you have such property for UltraComboEditor in the Properties Window, then most likely you have wrapped UltraComboEditor. If this is the case, please send me more information about your custom control. If you can send me a code snipped of your implementation it will be great.
You said that user puts the combo in edit mode. At first step, if the combo is empty your application should show some predefined message. Is this correct? If so, where do you show this message, e.g. message box, label, tooltip? At next step, if the user enters “OFFLINE”, your application should show some other message? Again, if this is correct where do you show this message? At last step, user deletes the entire text. At this point your application should show the same message as in first step. Is this correct?
At which events, of UltraComboEditor, are you checking if the value is empty string or equals to “OFFLINE”? Can you send me the listing of the code you have in these event handlers?
Please provide the above information, and I will be glad to try to implement a sample reproducing this behavior.
Looking forward to your reply.
Sorry, I am not able to send you the sample as it is not possible to add all that relevant references and I am also using vs2008, etc
Could you send me any other possibility for this?
Your scenario is a little more complex. I would like to investigate why this issue appears. However I will need a sample reproducing it. So please, try to isolate this behavior in a small sample project and send it to me for further investigation.
The regex I have shown you should match each combination of the word OFFLINE, as I wrote you. However if you need to match everything but this word try this one:
@"^(?!([\s]*[Oo][\s]*([Ff][\s]*){2}[Ll][\s]*[Ii][\s]*[Nn][\s]*[Ee][\s]*)).+"
Please let me know if you have any additional questions.
Thank you for using Infragistics Controls.