The Error List Window


The error list window looks like and acts very much like the task list, except this window is read-only, meaning you cannot add your own items to it—adding items is reserved only for compilers. When the code is compiled within Visual Studio, the output of the compilers are scanned, and one item is inserted into the error list for each error, warning, or message found. If you were to browse the objects, methods, and properties of the error list, you will find that many of the methods and properties on the ErrorList, ErrorItems, and ErrorItem objects work much like the methods and properties of the TaskList, TaskItems, and TaskItem objects.

The ErrorList object, the object representing the error list tool window in the user interface, can be found either by using the ToolWindows.ErrorList property or the Windows.Item method, passing in the EnvDTE80.WindowKinds.vsWindowKindErrorList constant, and then casting the Window.Object property into an ErrorList type:

     Sub FindErrorList()         Dim errorList As ErrorList         'Find the ErrorList object using the Windows.Item(...).Object style         errorList = DTE.Windows.Item _ (EnvDTE80.WindowKinds.vsWindowKindErrorList).Object         'Find the ErrorList object using the ToolWindows style         errorList = CType(DTE, DTE2).ToolWindows.ErrorList     End Sub 

Once you have the ErrorList object, you can get to the ErrorItems object, and then to an ErrorItem object. The differences between these objects and their counterparts, TaskList, TaskItems, and TaskItem, are that, obviously, the name Task has been replaced with Error; in objects, methods, and properties, the Add method has been removed from the collection object; and the properties ShowErrors, ShowWarnings, and ShowMessages have been added to the item object. These properties, which take and return a Boolean value, allow you to control and inspect to determine whether errors, warnings, and messages are visible within the error list.




Working with Microsoft Visual Studio 2005
Working with Microsoft Visual Studio 2005
ISBN: 0735623155
EAN: 2147483647
Year: 2006
Pages: 100

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net