I need rapidly adopt myself to existing system written in VB. For some bigger classes of VB forms (2000+ lines) and others, I would like to get their overview containing regions and declarations inside them (methods, functions, properties and class-level variables) which I can print/save for reference.
Currently I can achieve this manually by deleting bodies of methods and removing comments. I am also able to use some advanced regex (regual expression) searches to mark desired lines, then filter the rest out. List of declarations can be obtained using Reflection, but I think it is always without
In other words, I'd like to generate files similar to C/C++ headers but for VB and also includinginformation.
Public Class frmXY_Sample1
#Region "Internal Variables"
#Region "Form Common"
Private _Connection As SqlClient.SqlConnection
Private _DataFormType As XYZ.xyzDataFormType
Private AllowEvents As Boolean
#Region "Instance Data"
Private _Instance As thisEnt
#Region "Form Events"
Private Sub frmXY_SomeForm1_Load(sender As Object _
Private Sub ID_Save_Click(sender As System.Object, e As System.EventArgs) Handles ID_Save.Click
#Region "Tab 'SampleTab1'"
Private Sub TS_TAB1_AddNew_Click(sender As System.Object, e As System.EventArgs) _
Private Sub TS_TAB1_Detail_Click(sender As System.Object, e As System.EventArgs) _
#Region "Tab 'SampleTab2'"
Private Sub TS_TAB2_Detail_Click(sender As System.Object, e As System.EventArgs) _
Private Sub TS_TAB2_Refresh_Click(sender As System.Object, e As System.EventArgs) _
Private Sub TAB2_Grid_CellPainting(sender As System.Object _
There is nothing exactly like you are looking for in Visual Studio 2012 Professional. If you are working in a C# project, you can automatically get a code map similar to what you are looking for with the "Go To Definition" feature.
Here is a snippet of C# code.
Pressing F12 while the cursor is on the StreamReader class causes the following metadata editor to open.
Use Go To Definition to decode VB class
The VB editor also has a Go To Definition, but it takes you to the Object Browser instead of the metatdata window. But there is a way to get the metadata.
Create a separate C# project. In my example, I made a simple Console application. Add a reference to your VB project Write some code in the C# project to instantiate a type in the VB library and use the C# F12 to get the metadata
Here is a simple VB class.
This is the C# code referring to the Printer class.
Here is the metadata from the VB class, from within the C# project.
I know this is not as complete as your example, but it's a start.
There is a Code Map extension you can install from the
Tools\Extensions and Updates menu. I don't think it supports the printing option you want however.
Finally, you can create your own Visual Studio extension. This is not a trivial task though. Download the Visual Studio SDK if you want to learn more.