ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.ColEdit Event

Occurs whenever a cell first enters edit mode.

[Visual Basic]

Public Event ColEdit As ColEventHandler

[C#]

public event ColEventHandler ColEdit

[Delphi]

public property ColEdit: ColEventHandler read remove_ColEdit write add_ColEdit;

Remarks

The ColEdit event immediately follows the BeforeColEdit event only when the latter is not canceled.

When the user completes editing within a grid cell, as when tabbing to another column in the same row, pressing the ENTER key, or clicking on another cell, the BeforeColUpdate and AfterColUpdate events are executed if the data has been changed. The AfterColEdit event is then raised to indicate that editing is completed.

Example

The following code uses the ColEdit event to provide additional feedback while editing is in progress:

·      Visual Basic

       Private Sub C1TrueDBGrid1_ColEdit(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.ColEventArgs) Handles C1TrueDBGrid1.ColEdit

           Select Case e.Columns.DataColumn.Caption

               Case "OrderID"

                   Me.Label1.Text = "Enter 5-digit OrderID code"

               Case "CustomerID"

                   Me.Label1.Text = "Enter 5-letter CustomerID code"

           End Select

       End Sub

·      C#

       private void c1TrueDBGrid1_ColEdit(object sender, C1.Win.C1TrueDBGrid.ColEventArgs e)

       {

           switch(e.Column.DataColumn.Caption)

           {

               case "OrderID": this.label1.Text = "Enter 5-digit OrderID code";

                   break;

               case "CustomerID": this.label1.Text = "Enter 5-letter CustomerID code";

                   break;

           }

       }

·      Delphi

       procedure TWinForm.C1TrueDBGrid1_ColEdit(sender: System.Object; e: C1.Win.C1TrueDBGrid.ColEventArgs);

       var

         S: string;

       begin

         S := Self.C1TrueDBGrid1.Columns[e.ColIndex].Caption;

         if (S = 'OrderID') then

           Self.Label1.Text := 'Enter 5-digit OrderID code'

         else if (S = 'CustomerID') then

           Self.Label1.Text := 'Enter 5-letter CustomerID code';

       end;

For an example demonstrating the ColEdit event, see the Column Editing Events topic.

See Also

C1TrueDBGrid Class | C1TrueDBGrid Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.