Click here to Skip to main content
12,690,575 members (33,475 online)
Click here to Skip to main content
Articles » Languages » VB.NET » HowTo » Downloads

Stats

68.4K views
269 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
Architect Infragistics
United States United States

I’m a passionate Platform Architect at Infragistics.


I’m a long-time WPF-Prism fanatic who enjoys writing developer tools and line of business applications.


My current front end passions are: XAML platforms (Xamarin.Forms, Xamarin, UWP, and WPF), Electron, ES2015 (ES6), Node.js, Aurelia, and AngularJS (Angular 1.5.x).


For the back end I use what is appropriate for the project: SQL Server and ASP.NET WebAPI, MongoDB, Express, Azure, Firebase, etc.


I am very pragmatic software engineer and strive to write simple, maintainable, and testable code. Simple code allows for solving complex problems in a maintainable way.


My Blog


My Github Repros


My YouTube Videos


Just a grain of sand on the worlds beaches.


You may also be interested in...

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