Send raw data to a printer with VB .NET 2005?

C

Chris

pete said:
Does anyone have a working example of sending raw data to a printer with
VB.NET 2005? I've tried this example
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/vb05legacyhardware.asp
and got an error when trying to run it. The example listed above is close to
what I want to do, except I would like to send the data that is created on
the fly to the printer without using temporary files.

Thanks for your help,
Pete

I used that example to get me started. What error did you get?
 
W

webserverpete

Chris said:
I used that example to get me started. What error did you get?

I get the following error when I trun to run the program

Error 1 Handles clause requires a WithEvents variable defined in the
containing type or one of its base types.

It's complaining about this line

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
 
W

webserverpete

When I tried the example that you pointed out to me I get the following
errors

Warning 1 Variable 'di' is passed by reference before it has been
assigned a value. A null reference exception could result at runtime.
Make sure the structure or all the reference members are initialized
before use
Warning 2 Function 'SendStringToPrinter' doesn't return a value on all
code paths. A null reference exception could occur at run time when the
result is used.
Warning 3 Access of shared member, constant member, enum member or
nested type through an instance; qualifying expression will not be
evaluated.
Warning 4 Access of shared member, constant member, enum member or
nested type through an instance; qualifying expression will not be
evaluated.


I noticed that the article is for Dot Net 1.0 and Dot Net 1.1 but VB
2005 using Dot Net 2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top