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
public string CaptionText {get; set;}
public: __property String* get_CaptionText();
public: __property void set_CaptionText(String*);
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 ("").


[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

if(dataGrid1.CaptionText == "")
dataGrid1.CaptionText = "Microsoft DataGrid";

    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.


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