This documentation is archived and is not being maintained.

IsReadOnly Property

Visual Studio .NET 2003

Determines if the file containing the parent object is read-only.

[Visual Basic .NET]
Public ReadOnly Property IsReadOnly() As Boolean
[Visual Basic 6]
Property Get IsReadOnly() As Boolean
HRESULT __stdcall get_IsReadOnly(
   /* [out, retval] */ VARIANT_BOOL* retVal
public bool IsReadOnly {get;}
[JScript .NET]
public function get IsReadOnly() : Boolean


This example verifies if the file is read-only before adding a comment to the code element.

Sub AddComment()
    Dim vcElement As VCCodeElement
    Dim vcElements As VCCodeElements
    Dim textPoint As TextPoint
    vcElements = DTE.Solution.Item(1).CodeModel.Classes
    vcElement = vcElements.Item(1)
    If (Not vcElement.IsReadOnly) Then
        vcElement.Comment = "This is a comment."
    End If
End Sub

See Visual C++ Code Model Samples for information on how to compile and run this sample.

See Also

Applies To: VCCodeAttribute Object | VCCodeBase Object | VCCodeClass Object | VCCodeDelegate Object | VCCodeElement Object | VCCodeEnum Object | VCCodeEvent Object | VCCodeFunction Object | VCCodeIDLCoClass Object | VCCodeIDLImport Object | VCCodeIDLImportLib Object | VCCodeIDLLibrary Object | VCCodeImport Object | VCCodeInclude Object | VCCodeInterface Object | VCCodeMacro Object | VCCodeMap Object | VCCodeMapEntry Object | VCCodeNamespace Object | VCCodeParameter Object | VCCodeProperty Object | VCCodeStruct Object | VCCodeTypedef Object | VCCodeUnion Object | VCCodeUsing Object | VCCodeVariable Object