Visual Studio .NET has excellent debug facilities for examining your program’s variables, objects, and properties. However, they can be a little tedious to use, and they also only work while the program is in break mode. Some objects contain collections which are difficult to refer to by name unless you know all of the key names of the collection items.
For example, I wanted to be able to determine the column names of a datatable at run-time. In addition I wanted an easy way to see the values of those columns for a particular row. I also wanted to be able to see these values while the form was in run mode rather than break mode.
The following simple function populates a list box with the column names and values for a single row in a datatable. The function is declared as “shared” so that it can be called without having to instantiate an object from the class:
Public Class DebugHelper
Public Shared Sub FillListBoxDataRow( _
ByVal list As ListBox, _
ByVal row As DataRow)
Dim col As DataColumn
For Each col In row.Table.Columns
col.ColumnName & ": " & _
To use this helper function from anywhere in your application, simply place a listbox on a form, and call the function with the following line of code:
Pass in the name of the listbox, and a pointer to the row in the table you wish to examine, and the listbox will be filled with one row each for the columns in the row.
Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.