Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help with printing please!!! 1

Status
Not open for further replies.

iMacDan

IS-IT--Management
May 16, 2002
13
0
0
GB
Hi

I have an order program that has the usual details going into a list box, such as Product, Destination, price, quantity etc.

I can get a print out of the list box but that looks really plain.

I wondered whether there is a way of sending that information to a nice new form with some order form type bits! Like company logo etc etc?

 
One option is to create a form for printing. Put images, labels and textboxes on it. Then you can set all the textbox values and do a frm.PrintForm to print it out.
 
Thanks for your help.

I'm rather new to vb so not sure how to call up another form from my main form if that makes sense?

Also, would i make the print form an invisible one?

 
Add a new form to your project, lets assume is call frmPrintOut, and design that form to meet your printing needs. Lets also assume that you a print button on your main form called cmdPrint. Try this is in the click event of the print button.

Sub cmdPrint_Click

cmdPrint.Enabled = False

Load frmPrintOut
frmPrintOut.Hide
frmPrintOut.txtBox1.Text = "This value"
frmPrintOut.txtBox2.Text = cboMainFormCombo.Text
...
frmPrintOut.PrintForm
DoEvents
Unload frmPrintOut
Set frmPrintOut = Nothing

cmdPrint.Enabled = True

End Sub
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Thank you that does help a lot.

I'm just having real problems getting to grips with this whole VB thing!

Could I ask?
txtBox1 and txtBox2 are what I should set up on my new frmPrintOUt?

What is "This value" and cboMainFormCombo.text?

Sorry if you think i haven't got a hope of understanding don't worry thanks anyway!
 
I am guessing that since you want to print some data out on this form, that you going to have to take the data (which you have in a listbox. and other controls on you main form) at run time and store that into the controls on the form that you wish to print out, so that the printout has the correct data on it. txtBox1 and txtBox2 are two arbitrary text boxes that I placed on the frmPrintOut to use as an example to show you how to populate the controls on the printout form. In my example, I used a literal string, "This value" in one case, and I copied the value from a combo box in the second place.
You will need to replace those two lines with the code you need to fill out the print form with the specific items that you wish to show on the printout.


Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top