Me.errorProvider1.SetError(textBox1, errorMsg) ' Set the ErrorProvider error with the text to display. ' Cancel the event and select the text to be corrected by the user. If Not ValidEmailAddress(textBox1.Text, errorMsg) Then Private Sub textBox1_Validating(ByVal sender As Object, _īyVal e As ) Handles textBox1.Validating ' Confirm that there is an and a "." in the email address, and in the correct order.ĮrrorMessage = "Email address must be valid email address format." ControlChars.Cr _ Private Function ValidEmailAddress(ByVal emailAddress As String, ByRef errorMessage As String) As BooleanĮrrorMessage = "Email address is required." Confirm that there is an and a "." in the email address, and in the correct > -1)ĮrrorMessage = "email address must be valid email address format.\n" Confirm that the email address string is not empty.ĮrrorMessage = "email address is required." Public bool ValidEmailAddress(string emailAddress, out string errorMessage) Private void textBox1_Validated(object sender, System.EventArgs e) If(!ValidEmailAddress(textBox1.Text, out errorMsg)) Private void textBox1_Validating(object sender, *errorMessage = "email address must be valid email address format.\n" If ( emailAddress->IndexOf( ".", emailAddress->IndexOf( ) ) > emailAddress->IndexOf( ) ) Confirm that there is an and a "." in the email address, and in the correct order. *errorMessage = "email address is required." Confirm that the email address String* is not empty. If all conditions have been met, clear the ErrorProvider of errors.ĮrrorProvider1->SetError( textBox1, "" ) īool ValidEmailAddress( String^ emailAddress, interior_ptr errorMessage ) Void textBox1_Validated( Object^ sender, System::EventArgs^ e ) This->errorProvider1->SetError( textBox1, errorMsg ) Set the ErrorProvider error with the text to display. TextBox1->Select( 0, textBox1->Text->Length ) Cancel the event and select the text to be corrected by the user. If ( !ValidEmailAddress( textBox1->Text,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |