Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Cut
Run
Expand Minimize

IsFileOpen Method

Visual Studio .NET 2003

Returns True if the given file is open in the specified view.

[Visual Basic .NET]
Public Function IsFileOpen( _
   ByVal FileName As String, _
   Optional ByVal ViewKind As String = "{00000000-0000-0000-0000-000000000000}" _
) As Boolean
[Visual Basic 6]
Function IsFileOpen( _
   ByVal FileName As String, _
   Optional ByVal ViewKind As String = "{00000000-0000-0000-0000-000000000000}" _
) As Boolean
[C++]
HRESULT __stdcall IsFileOpen(
   BSTR FileName,
   BSTR ViewKind,
   /* [out, retval] */ VARIANT_BOOL* retVal
);
[C#]
public bool IsFileOpen(
   string FileName,
   string ViewKind
);
[JScript .NET]
public function IsFileOpen(
   FileName : String,
   ViewKind : String
) : Boolean

Parameters

FileName
Required. The virtual path based on the tree nodes from the left pane of the dialog box and the item name from the right pane.
ViewKind
Optional. A vsViewKind constant representing the type of view in which the file is open.

Return Value

True if the file is open in the specified view; False if not.

Example

Sub IsFileOpenExample()
   Dim ItemOp As ItemOperations
   ItemOp = DTE.ItemOperations
   ItemOp.NewFile("General\Text File", "Some name", _
     Constants.vsViewKindTextView)
   If ItemOp.IsFileOpen("A document") = True Then
      MsgBox("The document is open.")
   Else
      MsgBox("The document is not open.")
   End If
End Sub

See Also

Applies To: ItemOperations Object

Show:
© 2015 Microsoft