GrapeCity MultiRow Windows Forms Documentation
ErrorText Property (Row)
Example 


Gets or sets the error message text for row level errors.
Syntax
<BrowsableAttribute(False)>
<DefaultValueAttribute()>
Public Property ErrorText As String
Dim instance As Row
Dim value As String
 
instance.ErrorText = value
 
value = instance.ErrorText
[Browsable(false)]
[DefaultValue()]
public string ErrorText {get; set;}

Property Value

A System.String that contains the error message. The default is String.Empty.
Remarks
Use this property to provide an error message for row level errors. The specified message is displayed in a ToolTip when the user moves the mouse pointer over the error icon shown in the row header cell. If this row is associated with a GcMultiRow control, setting this property raises the GcMultiRow.RowErrorTextChanged event.
Example
The following code example shows how to use this property to notify the user of a row value error. To run this example, create a windows form, and add a GcMultiRow control to the form. Add a RowHeaderCell and a TextBoxCell named "Name" to the MultiRow controls template. Add the event handle of this event and copy the following code into the event handler. Input an invalid value and try to move the focus. See what happens.
void gcMultiRow1_RowValidating(object sender, CellCancelEventArgs e)
        {
            if (e.CellName == "Name" && this.gcMultiRow1[e.RowIndex, "Name"].Value == null)
            {
                e.Cancel = true;

                // Set the error text to display why the cell validating failed.
                this.gcMultiRow1.Rows[e.RowIndex].ErrorText = "The student name can't be empty, please input the name.";
            }
            else
            {
                this.gcMultiRow1.Rows[e.RowIndex].ErrorText = string.Empty;
            }
        }
Private Sub gcMultiRow1_RowValidating(ByVal sender As Object, ByVal e As CellCancelEventArgs) Handles gcMultiRow1.RowValidating
        If e.CellName = "Name" AndAlso Me.gcMultiRow1(e.RowIndex, "Name").Value = Nothing Then
            e.Cancel = True

            ' Set the error text to display why the cell validating failed.
            Me.gcMultiRow1.Rows(e.RowIndex).ErrorText = "The student name can't be empty, please input the name."
        Else
            Me.gcMultiRow1.Rows(e.RowIndex).ErrorText = String.Empty
        End If
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Row Class
Row Members
ShowRowErrors Property

 

 


Copyright © GrapeCity, inc. All rights reserved.