Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » HowTo » Downloads
 
Add your own
alternative version

Authoring Visual Studio Debugger Visualizers

, 26 Jan 2008
An article on developing and debugging Visual Studio Debugger Visualizers.
Imports Microsoft.VisualStudio.DebuggerVisualizers

Public Class frmStringVisualizer

#Region " Declarations "

    Private _objObjectProvider As _
        IVisualizerObjectProvider

#End Region

#Region " Properties "

    Public Property ObjectProvider() As _
        IVisualizerObjectProvider
        Get
            Return _objObjectProvider
        End Get
        Set(ByVal Value As IVisualizerObjectProvider)
            _objObjectProvider = Value
        End Set
    End Property

    Public Property StringToVisualize() As String
        Get
            Return Me.txtString.Text
        End Get
        Set(ByVal Value As String)
            Me.txtString.Text = Value
        End Set
    End Property

#End Region

#Region " Methods "

    Private Sub btnClose_Click(ByVal sender As _
        System.Object, ByVal e As System.EventArgs) _
        Handles btnClose.Click
        Me.Close()

    End Sub

    Private Sub btnReplaceText_Click(ByVal sender As _
        System.Object, ByVal e As System.EventArgs) _
        Handles btnReplaceText.Click
        'There are two ways to replace data.  Take your choice.
        '
        '1.  use the ReplaceData Method
        Using ms As New System.IO.MemoryStream
            StringVisualizerObjectSource.Serialize( _
                ms, Me.StringToVisualize)
            ObjectProvider.ReplaceData(ms)
            ms.Close()
        End Using
        '2.  use the ReplaceObject Method
        'ObjectProvider.ReplaceObject(Me.StringToVisualize)
        Me.Close()

    End Sub

    Private Sub frmStringVisualizer_Load(ByVal sender _
        As System.Object, ByVal e As _
        System.EventArgs) Handles MyBase.Load
        Me.btnReplaceText.Enabled = _
            Me.ObjectProvider.IsObjectReplaceable

        If Me.btnReplaceText.Enabled Then
            Me.ToolTip1.SetToolTip(Me.btnReplaceText, _
                "Click to replace the original text with what you " _
                & _
                "have entered in the above textbox.")

        Else
            Me.ToolTip1.SetToolTip(Me.btnReplaceText, _
                "The source object does not support replacement.")
        End If

    End Sub

    Private Sub txtString_TextChanged(ByVal sender As _
        Object, ByVal e As System.EventArgs) Handles _
        txtString.TextChanged
        Me.lblStringLength.Text = String.Format( _
            "{0} characters", _
            Me.txtString.Text.Trim.Length)

    End Sub

#End Region

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Karl Shifflett
Architect Gayle Manufacturing Company
United States United States
Karl loves .NET, WPF, WCF, ASP.NET, VB.NET and C#.
 
Awards:
 
  • December 2008 VB.NET Code Project Article Award
  • 2009 Code Project MVP
  • 2008 Code Project MVP
  • 2008 Microsoft MVP - Client App Dev
  • December 2007 VB.NET Code Project Article Award
  • Gold Medal Winner at IBM's 1998 PROIV Programming Contest in Las Vegas
Click here to check out my Blog
 
Click here to learn about Mole 2010 debugging tool for Visual Studio 2010
 
Click here to read about XAML Power Toys
 

Just a grain of sand on the worlds beaches.

Follow on   Twitter

| Advertise | Privacy | Mobile
Web04 | 2.8.140814.1 | Last Updated 26 Jan 2008
Article Copyright 2008 by Karl Shifflett
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid