Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Validation in Wizards Empty Validation in Wizards

Thu 20 Dec 2018 - 10:53
Original post by Gareth Ahmun

Firstly apologies that this relates to Designer rather than Scripting (there is no Designer forum).

Is the only way to validate a number being input using the spinner control? 

Can this validation be achieved with a standard text box?

Thanks, Gareth
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Validation in Wizards Empty Re: Validation in Wizards

Thu 20 Dec 2018 - 10:56
Original post by Daniel Thompson

Hello Gareth To do it with out the Spinner control does require scripting so you are in the correct area. You would be best to use the Changed Event then validate the value if incorrect show a message box and blank the result.

Code:
protected virtual void txtNumber_Changed(object sender, System.EventArgs e)
{
    value = 0;
    string tovalidate = Convert.ToString(EnquiryForm.GetIBasicEnquiryControl2("txtNumber", EnquiryControlMissing.Exception).Value);
    if (int.TryParse(tovalidate, out value) == false && String.IsNullOrEmpty(tovalidate)== false)
    {
        FWBS.OMS.UI.Windows.MessageBox.ShowInformation(“Value is incorrect”);
        EnquiryForm.GetIBasicEnquiryControl2(“txtNumber”,EnquiryControlMissing.Exception).Value = "";
        EnquiryForm.GetControl("txtNumber").Focus();
    }
}
Back to top
Permissions in this forum:
You cannot reply to topics in this forum