GetValidationSummary – Builds a validation summary for all the controls inside a container

' Return a validation summary string with all the error messages, if any,'  of the controls inside the specified container,'  associated to an ErrorProvider control' ' Example:'    Dim summary As String = ""'    ' display the validation summary for all the controls on the form'    summary = GetValidationSummary(Me, ErrorProvider1)'    If summary.Length > 0 Then'       MessageBox.Show(summary, "ERRORS", MessageBoxButtons.OK,'  MessageBoxIcon.Error)'    End If'    ' display the validation summary for all the controls inside a GroupBox'    summary = GetValidationSummary(GroupBox1, ErrorProvider1)'    If summary.Length > 0 Then'       MessageBox.Show(summary, "ERRORS", MessageBoxButtons.OK,'  MessageBoxIcon.Error)'    End IfFunction GetValidationSummary(ByVal container As Control, _    ByVal errorProv As ErrorProvider) As String    Return GetValidationSummary(container, errorProv, " - ")End FunctionFunction GetValidationSummary(ByVal container As Control, _    ByVal errorProv As ErrorProvider, ByVal prefix As String) As String    Dim summary As New System.Text.StringBuilder    Dim ctl As Control    ' for each control in the container (and its sub controls)...    For Each ctl In GetAllControls(container)        ' check the associated error message        Dim msg As String = errorProv.GetError(ctl)        ' if the error message is not null, add it to the summary        If msg.Length > 0 Then            If summary.Length > 0 Then                summary.Append(Environment.NewLine)            End If            summary.Append(prefix)            summary.Append(msg)        End If    Next    Return summary.ToString()End Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS