Click here to Skip to main content
12,072,067 members (60,328 online)
Click here to Skip to main content
Articles » Languages » VB.NET » HowTo » Downloads

Stats

62.9K views
249 downloads
53 bookmarked
Posted

Authoring Visual Studio Debugger Visualizers

, 26 Jan 2008 CPOL
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
Technical Lead Logical Advantage
United States United States

Christian, Husband, Dad, Biker, Marine Corps Veteran, stage IV cancer survivor.


Current passions are: Electron, ES6, Aurelia, hybrid, and IoT.


At work it's C#, ASP.NET Web Api, Ionic, ES5, TypeScript, AngularJS


Still keen on WPF and Prism, but currently Electron and ES6 deliver the same apps.


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

Just a grain of sand on the worlds beaches.


You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160208.1 | Last Updated 26 Jan 2008
Article Copyright 2008 by Karl Shifflett
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid