![]() ![]() If the TextBox on the form is left blank and if the Button is clicked, an icon will be displayed to the TextBox and the specified text will appear in the Tool Tip box when the mouse is over the control. MyErrorProvider.SetError("DistanceTextBox", "This field is required") But it seems that by the time TextBox_validating executes it's too late and we get, anyway, the generic message: Input string is not in correct formatĬan you please suggest a solution either:ġ- How to intercept the framework before it displays the generic warning: Input string is not in correct format so that I display the message I want.Ģ- How to go and change that generic CSLA message which seems to apply when the user does not enter a value in a TextBox which is bound to an INTEGER property. Assume we have a TextBox and a Button on a form. I tried going to my textbox validating event and setting this : However the client insists that we display the message : This field is required. When the user does not include an input in the textbox distance, CSLA displays for me a warning red icon with the generic error: Input String Not in Correct format. ![]() Create an instance of this control object and then assign the properties you would like this control to have. MasterValueBindingSource.DataSource = MyMasterValue It is very simple to use the ErrorProvider object in your application. MasterValueBindingSource has its datasource set to my MasterValue Instance. Private Sub ccTextBoxValidating(ByVal sender As Object, ByVal e As ) Handles ccTextBox.Validating Dim paymentString As String Me.PaymentTypeComboBox.GetItemText(PaymentTypeComboBox.SelectedItem) 'Checks the payment method for not 'Cash' If paymentString <> 'Cash' Then Me.ErrorProvider.Private Sub btnInsertClick (sender As Object, e As EventArgs) Handles btnInsert. I also have an error provider on my form whose datasource is MasterValueBindingSource. Below is the code that I tried to do so what I have mentioned above but somehow it is not working. I have a textbox " DistanceTextBox" bound to an property Distance of type INTEGER in my business object MasterValue. Private Sub TextBoxValidating( sender As System.Object, e As ) Handles TextBox1.Validating, TextBox2.Validating, ComboBox1.Validating Dim ctl As Control CType(sender, Control) If ctl.Text '' e.Cancel True ErrorProvider1. Tutus posted on Tuesday, September 22, 2009
0 Comments
Leave a Reply. |