Click here to Skip to main content
12,759,432 members (34,762 online)
Click here to Skip to main content
Add your own
alternative version


29 bookmarked
Posted 16 Feb 2003

Object Explorer

, 16 Feb 2003
Rate this:
Please Sign up or sign in to vote.
Provides a Windows Forms control for viewing an object state during execution.


In medium to large scale IT project you will end up with quite a lot of business logic objects. To test each one of them you generally create some kind of test window that will accept initial data, run some logic, and then display new object states. So we will have window with a nice [GO!] command button and a bunch of labels to display properties and fields of a business entity after processing, and a couple of dozens lines of boring code to copy data from object instance to these labels. If your object contains collection or other objects, your choices will be:

  1. Test it in debugger.
  2. Spend a working day or two just to create a decent test window.

In mine opinion, a programmer should be lazy enough to spend 9 hours 59 minutes to create tool that can do something that can be done manually in 10 hours, and than have 1 minute to enjoy while the magic happens.

Instead of making copy-paste functionality for each business entity we want to check, let's build a generic black box which can accept objects and display everything it has inside. Using reflection, there is no object we cannot disassemble!

Our Windows Control Library contains user control that you can use as part of your test window and a complete "Display object state" window. Object properties are presented in a ListView. You can double-click on any non-primitive field or property to display its state (drill down).

Feel free to use this code; it will be great if it will save you some boring coding time. As usual any suggestions will be appreciated.

Using the Code

  • Add reference to the WindowsUtils assembly to your test project.
  • Add the using case:
    using ClalBit.Infrastruct.WindowsUtils;
  • Add the following wherever you want to display your object state:
    frmObjectProperties frm = new frmObjectProperties(objectToExplore, "ObjectName");

In case you want to create a more complicated test window, you can use the ObjectProperties control instead. Just drop it onto your form and call the SetObject method on it. See frmObjectProperties for an example.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Leon Langleyben
Web Developer
Israel Israel
Leon works as Chief Architect at SRL Group. He leads architectural design and development of various enterprise level projects.
You can meet him on user groups, conferences and forums dedicated to Architecture, ASP.NET, Team System etc. or join him for the next white water rafting adventure

You may also be interested in...

Comments and Discussions

GeneralReturn Type Pin
Sanjivc22-Mar-04 3:51
sussSanjivc22-Mar-04 3:51 
Questionmissing dll? Pin
omoshima18-Feb-03 17:56
memberomoshima18-Feb-03 17:56 
AnswerRe: missing dll? Pin
Leon Langleyben18-Feb-03 22:21
memberLeon Langleyben18-Feb-03 22:21 
GeneralRe: missing dll? Pin
omoshima20-Feb-03 22:16
memberomoshima20-Feb-03 22:16 
GeneralRe: missing dll? Pin
Leon Langleyben22-Feb-03 20:25
memberLeon Langleyben22-Feb-03 20:25 
QuestionWhy not just use the propertygrid? Pin
leppie18-Feb-03 11:02
memberleppie18-Feb-03 11:02 
AnswerRe: Why not just use the propertygrid? Pin
Leon Langleyben18-Feb-03 22:12
memberLeon Langleyben18-Feb-03 22:12 
QuestionCan you Provide? Pin
Delegate18-Feb-03 7:29
memberDelegate18-Feb-03 7:29 
AnswerRe: Can you Provide? Pin
Furty18-Feb-03 17:24
memberFurty18-Feb-03 17:24 
QuestionWhy not use the Debugger? Pin
Heath Stewart17-Feb-03 18:55
editorHeath Stewart17-Feb-03 18:55 
AnswerRe: Why not use the Debugger? Pin
Leon Langleyben18-Feb-03 0:41
memberLeon Langleyben18-Feb-03 0:41 
GeneralRe: Why not use the Debugger? Pin
Heath Stewart18-Feb-03 18:05
editorHeath Stewart18-Feb-03 18:05 
AnswerRe: Why not use the Debugger? Pin
Lee Alexander21-Mar-04 22:39
memberLee Alexander21-Mar-04 22:39 
GeneralRe: Why not use the Debugger? Pin
Heath Stewart22-Mar-04 4:11
editorHeath Stewart22-Mar-04 4:11 
GeneralRe: Why not use the Debugger? Pin
Lee Alexander22-Mar-04 4:34
memberLee Alexander22-Mar-04 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170217.1 | Last Updated 17 Feb 2003
Article Copyright 2003 by Leon Langleyben
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid