printing source code

  • Thread starter Thread starter Jesse Aufiero
  • Start date Start date
J

Jesse Aufiero

is there a utility program, other than 'VS.Net Code Print', that can print
source code from a visual studio 2005 solution? 'VS.Net Code Print' is
buggy and crashes before completing the print of my solution.

Thanks!!!
 
Hi Jesse,

This code should help you:
---------------------------CODE STARTS-----------------------------
For Each fil As IO.FileInfo In New IO.FileInfo("..\..\" & _

Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf("\"))) _
.Directory.GetFiles("*.vb")

Debug.WriteLine("FILE NAME :: " & fil.Name.ToString)

Dim ba() As Byte = New Byte(fil.Length) {}

'Read the contents of the file
fil.OpenRead().Read(ba, 0, fil.Length)
Debug.WriteLine(System.Text.ASCIIEncoding.Default.GetString(ba))

Debug.WriteLine("--------Manish------------------")
Next
-----------------------------CODE ENDS------------------------------

In the above code, the code starts with getting the root directory of the
Executable and parsing to the Bin and then Debug. And ultimately to the Root
of the project, which contains all the Source code files.

Then we are searching for all code files (.VB here, can be set to .CS in
case of C#); then reading the contents of this source code and printing it in
debug window.

The same data be be printed directly using the print document object, as
described in the following article:
http://www.vbdotnetheaven.com/UploadFile/mgold/PrintinginVBNET04202005015906AM/PrintinginVBNET.aspx

I hope this helps!
-Rajneesh

www.ComponentOne.com
 
Back
Top