This documentation is archived and is not being maintained.

DataGrid.CaptionText Property

Gets or sets the text of the grid's window caption.

[Visual Basic]
Public Property CaptionText As String
[C#]
public string CaptionText {get; set;}
[C++]
public: __property String* get_CaptionText();
public: __property void set_CaptionText(String*);
[JScript]
public function get CaptionText() : String;
public function set CaptionText(String);

Property Value

A string to be displayed as the grid's window caption. The default is an empty string ("").

Example

[Visual Basic, C#, C++] The following example sets the caption of a System.Windows.Forms.DataGrid.

[Visual Basic] 
If DataGrid1.CaptionText = "" Then
    DataGrid1.CaptionText = "Microsoft DataGrid"
End If


[C#] 
if(dataGrid1.CaptionText == "")
dataGrid1.CaptionText = "Microsoft DataGrid";


[C++] 
if(dataGrid1->CaptionText->Equals(S""))
    dataGrid1->CaptionText = S"Microsoft DataGrid";

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DataGrid Class | DataGrid Members | System.Windows.Forms Namespace | CaptionVisible | CaptionForeColor | CaptionFont | CaptionBackColor

Show: