GrapeCity MultiRow Windows Forms Documentation
EditingControlShowingEventArgs Class
Members  Example 


Provides data for the GcMultiRow.EditingControlShowing event of the GcMultiRow control.
Object Model
EditingControlShowingEventArgs ClassCellStyle Class
Syntax
Public Class EditingControlShowingEventArgs 
   Inherits System.EventArgs
public class EditingControlShowingEventArgs : System.EventArgs 
Remarks

You can handle the GcMultiRow.EditingControlShowing event to perform custom initialization of the editing control when a cell enters edit mode. To customize the display characteristics of the control, set the properties of the object returned by the CellStyle property. To perform other initializations, cast the value of the Control property to the specific control type and access the members directly. For example, you can handle the EditingControlShowing event to attach event handlers to the events of the editing control.

The GcMultiRow control hosts one editing control at a time, and reuses the editing control whenever the cell type does not change between edits. When attaching event handlers to the editing control, you should take precautions to avoid attaching the same handler multiple times. To avoid this problem, remove the handler from the event before you attach the handler to the event. This will prevent duplication if the handler is already attached to the event, but will have no effect otherwise.

Example
The following code example shows how to initialize the editing control. This code example is part of a larger example provided for the GcMultiRow.EditingControlShowing event.
void gcMultiRow_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
        {
            // Change editing control's backcolor.
            e.CellStyle.BackColor = Color.Red;

            TextBox textBox = e.Control as TextBox;

            if (textBox != null)
            {
                // Add TextChange event handler.
                textBox.TextChanged -= new EventHandler(textBox_TextChanged);
                textBox.TextChanged += new EventHandler(textBox_TextChanged);
            }
        }
Private Sub gcMultiRow_EditingControlShowing(ByVal sender As Object, ByVal e As EditingControlShowingEventArgs) Handles gcMultiRow.EditingControlShowing
        ' Change editing control's backcolor.
        e.CellStyle.BackColor = Color.Red

        Dim textBox As TextBox = TryCast(e.Control, TextBox)

        If Not textBox Is Nothing Then
            ' Add TextChange event handler.
            RemoveHandler textBox.TextChanged, AddressOf textBox_TextChanged
            AddHandler textBox.TextChanged, AddressOf textBox_TextChanged
        End If
    End Sub
Inheritance Hierarchy

System.Object
   System.EventArgs
      GrapeCity.Win.MultiRow.EditingControlShowingEventArgs

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

EditingControlShowingEventArgs Members
GrapeCity.Win.MultiRow Namespace
EditingControlShowing Event
EditingControl Property

 

 


Copyright © GrapeCity, inc. All rights reserved.