print out

laloush83

Member
Joined
Oct 26, 2005
Messages
9
Programming Experience
Beginner
hello.. I'm a beginner in vb .net.
I'm developing a simple form and I need to print out the values entered by the user into text boxes.. but I'm really lost and I don't know how to do it.. can anyone help me plz?
 
print out where? on printer, console screen, messagebox???

If you are talking about printing on papper you can use PrintDocument in vs.net but if it's something more complicated you must create report (use cristal reports or some other component).
 
thanx ManicCW for ur reply..
I need to print out on a printer..
I tried to use the printDocument without success so if u can send me simple code how to use it to print the text of the textBoxes in a format that I specify.
If I want to use the crystal report.. how can I access the controls of the report from the main form to fill them with the text I want.
I'll be thankful for any reply.
 
Printing from vb is not so simple and it requires great deal of coding (search msdn for detailed info). Here is simple code to print word on page:

Drag and drop PrintDocument and Button on designer. On Click event of the button write this:

VB.NET:
myPrintDocument.Print()

In PrintPage event write:

VB.NET:
Dim myFont As Font
myFont = New Font("Tahoma", 14)
e.Graphics.DrawString("Your string here", myFont, Brushes.Black, 25, 25)
 
Last edited:
And for crystal I can't say much because I don't use crystal reports but I think you should not access form's elements but instead you should fill dataset with data and then bind report with that dataset.

But if you want to access data directly from the textbox then declare textbox (and form) as Public and then you should be able to access its properties.
 
Last edited:
Back
Top