This documentation is archived and is not being maintained.

DataGrid.BorderStyle Property

Gets or sets the grid's border style.

[Visual Basic]
Public Property BorderStyle As BorderStyle
[C#]
public BorderStyle BorderStyle {get; set;}
[C++]
public: __property BorderStyle get_BorderStyle();
public: __property void set_BorderStyle(BorderStyle);
[JScript]
public function get BorderStyle() : BorderStyle;
public function set BorderStyle(BorderStyle);

Property Value

One of the BorderStyle enumeration values. The default is FixedSingle.

Example

[Visual Basic] The following example sets the style of the grid's border.

[Visual Basic] 
Private Sub SetBorderStyle(ByRef myGrid As DataGrid, ByRef style As Integer)
    Select Case style
    Case 0
       myGrid.BorderStyle = System.Windows.Forms.BorderStyle.None
    Case 1
       myGrid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Case 2 
       myGrid.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Case Else
       myGrid.BorderStyle = System.Windows.Forms.BorderStyle.None
    End Select
 End Sub
    

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic 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

Show: