ItemOperations.OpenFile(String, String) Method

Definition

Opens a file as though you invoked an Open File command in the integrated development environment (IDE).

EnvDTE::Window OpenFile(std::wstring const & FileName, std::wstring const & ViewKind = "{00000000-0000-0000-0000-000000000000}");
[System.Runtime.InteropServices.DispId(3)]
public EnvDTE.Window OpenFile (string FileName, string ViewKind = "{00000000-0000-0000-0000-000000000000}");
[<System.Runtime.InteropServices.DispId(3)>]
abstract member OpenFile : string * string -> EnvDTE.Window
Public Function OpenFile (FileName As String, Optional ViewKind As String = "{00000000-0000-0000-0000-000000000000}") As Window

Parameters

FileName
String

Required. The full path and name of the file to be opened.

ViewKind
String

Optional. A ConstantsvsViewKind* constant specifying the type of view in which to create the file.

Returns

A Window object.

Attributes

Examples

Sub OpenFileExample()  
   Dim ItemOp As ItemOperations  
   ItemOp = DTE.ItemOperations  
   ' Open a log file as a text document.  
   ItemOp.OpenFile("c:\windows\ocgen.log", Constants.vsViewKindTextView)  
End Sub  

Applies to