ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1DataColumn.DefaultValue Property

Gets or sets the default value for a column when a new row is added by the grid.

[Visual Basic]

Public Property DefaultValue As String

[C#]

public string DefaultValue {get;set;}

[Delphi]

public property DefaultValue: String read get_DefaultValue write set_DefaultValue;

Remarks

This property returns or sets the default value of an unbound grid column in a bound grid. Unbound columns are typically used to display calculated fields or local data not maintained by the primary data source.

This property applies only to unbound columns. The value specified will be preloaded into the last argument passed to the C1TrueDBGrid.UnboundColumnFetch event.

The DefaultValue property can also be used to identify specific columns in the C1TrueDBGrid.UnboundColumnFetch event when columns are added, moved, or removed at run time.

This property can also be used as a tag for a column (whether it is bound or unbound). Arbitrary values can be stored and retrieved later.

Example

The following code uses the DefaultValue property to set the text for the column that will appear when a new row is created:

·      Visual Basic

       Me.C1TrueDBGrid1.Columns(0).DefaultValue = "Name"

·      C#

       this.c1TrueDBGrid1.Columns[0].DefaultValue = "Name";

·      Delphi

       Self.C1TrueDBGrid1.Columns[0].DefaultValue := 'Name';

See Also

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


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