Поделиться через


TaskItem.FileName Property

Sets or gets a string representing the file name that was passed to the Task List window when the task item was created.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Property FileName As String
string FileName { get; set; }
property String^ FileName {
    String^ get ();
    void set (String^ value);
}
abstract FileName : string with get, set
function get FileName () : String 
function set FileName (value : String)

Property Value

Type: System.String
A string representing the file name that was passed to the Task List window when the task item was created.

Remarks

The empty string is a special token that indicates there is no file name associated with the task item. The FileName property returns the error, Unspecified Error, if there is no value for it (that is, no file name).

Examples

[Visual Basic]

Sub FilenameExample()
   ' Before running, add a task to the Task List.
   Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindTaskList)
   Dim TL As TaskList = win.Object
   Dim TLItem As TaskItem = TL.TaskItems.Item(1)
   Dim msg As String

   ' List properties of the Task Item.
   msg = "TaskItem Category property value: " & TLItem.Category & vbCr
   msg = msg & "TaskItem SubCategory property value: " & TLItem.SubCategory & vbCr
   msg = msg & "TaskItem Checked property value: " & TLItem.Checked & vbCr
   msg = msg & "TaskItem Displayed property value: " & TLItem.Displayed & vbCr
   ' The following line will fail with an error unless a file is 
   ' associated with the Task Item.
   msg = msg & "TaskItem Filename property value: " & TLItem.FileName & vbCr
   msg = msg & "TaskItem IsSettable property value: " & TLItem.IsSettable(vsTaskListColumn.vsTaskListColumnCheck) & vbCr
   msg = msg & "TaskItem Priority property value: " & TLItem.Priority & vbCr
   MsgBox(msg)
End Sub

.NET Framework Security

See Also

Reference

TaskItem Interface

EnvDTE Namespace