ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

ValueItems.DefaultItem Property

Gets or sets the index of the default ValueItem or -1 for no default.

[Visual Basic]

Public Property DefaultItem As Integer

[C#]

public int DefaultItem {get;set;}

[Delphi]

public property DefaultItem: Int32 read get_DefaultItem write set_DefaultItem;

Remarks

When the DefaultItem property is set to a valid collection index (an integer between 0 and Count - 1 inclusive), then the corresponding ValueItem is displayed when the grid encounters a value that is not present in the ValueItems object.

When the DefaultItem property is set to -1, then the grid will not substitute a ValueItem when it encounters a value that is not present in the ValueItems object.

A trappable error will occur if you attempt to set this property to an invalid value.

Example

The following code sets the default value to no default value:

·      Visual Basic

       Me.C1TrueDBGrid1.Columns("Country").ValueItems.DefaultItem = -1

·      C#

       this.c1TrueDBGrid1.Columns["Country"].ValueItems.DefaultItem = -1;

·      Delphi

       Self.C1TrueDBGrid1.Columns['Country'].ValueItems.DefaultItem := -1;

See Also

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


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