VB.NET - Error provider in vb.net - Asked By Monoj Kumar Muchahari on 14-May-08 08:17 AM

I have one "TextBox" and a "ComboBox", which i want to validate if blank is selected using errorprovider in vb.net. Please help.

Articles - Shailendrasinh Parmar replied to Monoj Kumar Muchahari on 14-May-08 08:46 AM

See the following articles for that ::

http://www.startvbdotnet.com/controls/tooltip.aspx
http://www.java2s.com/Code/VB/GUI/UseErrorProvider.htm

VB.Net error provider to validate Textbox / Combobox - Rakesh Vikram replied to Monoj Kumar Muchahari on 15-May-08 12:42 AM

Go through the below articles.

----------------------------------------------------------------------------------------ErrorProvider as a 'Warning Provider' - http://www.codeproject.com/KB/validation/WarningProvider.aspx

----------------------------------------------------------------------------------------Making Use of the Error Provider Control - http://www.c-sharpcorner.com/UploadFile/scottlysle/UseErrorProvider03082007210138PM/UseErrorProvider.aspx

----------------------------------------------------------------------------------------How to cancel a form's Error Provider? - http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic63255.aspx

Hope these articles helps in finding a solution.

Rakesh Vikram

Example: - Chirag Bhavsar replied to Monoj Kumar Muchahari on 15-May-08 08:40 AM

For information about error provider refer this link:

http://msdn.microsoft.com/en-us/library/system.windows.forms.errorprovider_methods.aspx

for Example: http://msdn.microsoft.com/en-us/library/system.windows.forms.errorprovider(VS.71).aspx

the link above contains the example of error provider class for a textbox and dropdownlist which is the exact match that i could find.

alice johnson replied to Monoj Kumar Muchahari on 20-May-08 12:38 PM

if(combobox.selectedvalue=="")

{

errorProvider1.setError(......);

msgbox(Erroeprovider.Geterror(...............);

}

David replied to Monoj Kumar Muchahari on 29-Apr-11 04:00 AM
Imports System.Text.RegularExpressions
Public Class frm

    Private Sub ERROR(ByVal sender As Object, ByVal e As System.EventArgs) Handles tx.Validated, txt.Validated, txt.Validated
      Dim ctlA As Control

      ctlA = CType(sender, Control)
      erprvdStraat.SetError(ctlA, String.Empty)


    End Sub

    Private Sub ControleOpLeeg(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txt.Validating, txt.Validating, txt.Validating
    
      Dim ctlA As Control

      
      ctlA = CType(sender, Control)

      If ctlA.Text.Trim = String.Empty Then
        e.Cancel = True
        erprvdA.SetError(ctlA, "ERROR")

      End If


    End Sub

    Private Sub txt_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txt.Validating
      
      Dim ctlSender As Control
      ctlA = CType(sender, Control)

     If Not System.Text.RegularExpressions.Regex.IsMatch(ctlA.Text.Trim, "\d\d\d\d") Then
        e.Cancel = True
        erprvd.SetError(ctlA, "ERROR")


      End If
    End Sub

End Class
GotiBandhu replied to Monoj Kumar Muchahari on 07-Oct-11 10:59 AM
Hello Friends,
ErrorProvider allows us to set an error message for any control on the form when the input is not valid. When an error message is set, an icon indicating the error will appear next to the control and the error message is displayed as Tool Tip when the mouse is over the control................................. for more information check the following URL...

http://www.mindstick.com/Articles/ece4d0e8-4332-4d0a-9fac-078fbe3f78dd/?ErrorProvider%20Control%20in%20VB.Net

Thanks !!!!