Szerkesztés

Megosztás a következőn keresztül:


DataGridTableStyle.ReadOnly Property

Definition

Gets or sets a value indicating whether columns can be edited.

public:
 virtual property bool ReadOnly { bool get(); void set(bool value); };
public virtual bool ReadOnly { get; set; }
member this.ReadOnly : bool with get, set
Public Overridable Property ReadOnly As Boolean

Property Value

true, if columns cannot be edited; otherwise, false.

Examples

The following code example returns the ReadOnly property for each DataGridTableStyle in a GridTableStylesCollection.

private:
   void PrintReadOnlyValues()
   {
      for each ( DataGridTableStyle^ tableStyle in dataGrid1->TableStyles )
      {
         Console::WriteLine( tableStyle->ReadOnly );
      }
   }
private void PrintReadOnlyValues()
{
    foreach(DataGridTableStyle tableStyle in dataGrid1.TableStyles)
    {
      Console.WriteLine(tableStyle.ReadOnly);
    }
}
Private Sub PrintReadOnlyValues()
    Dim tableStyle As DataGridTableStyle
    For Each tableStyle In  dataGrid1.TableStyles
        Console.WriteLine(tableStyle.ReadOnly)
    Next tableStyle
End Sub

Remarks

You can also specify whether individual columns within the table are editable by setting the DataGridColumnStyle class's DataGridColumnStyle.ReadOnly property to an appropriate value, true or false.

Alternatively, to ensure that the data is not edited, you can set the DataColumn class's ReadOnly property to true.

Applies to