473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to print the contents in a form?

164 100+
In my form I have few label and text boxes and a pi'cture box. What i want is to print the entire form contents including the image. Printform method not working correctly.

If I used that method it prints the contents within a limited portion in the A4 size paper.. Even if the contents are less I want to get the printout in the Wholw paper
Feb 7 '07 #1
8 8909
hariharanmca
1,977 1GB
In my form I have few label and text boxes and a pi'cture box. What i want is to print the entire form contents including the image. Printform method not working correctly.

If I used that method it prints the contents within a limited portion in the A4 size paper.. Even if the contents are less I want to get the printout in the Wholw paper

i'm not getting why you are printing it to form? You can directly print it to paper.
Feb 7 '07 #2
arunbalait
164 100+
Sorry sorry to paper via printer... Ok now?
Feb 7 '07 #3
hariharanmca
1,977 1GB
Sorry sorry to paper via printer... Ok now?
i think this page will help you

http://www.thescripts.com/forum/thread586885.html
Feb 7 '07 #4
Killer42
8,435 Expert 8TB
i think this page will help you ...
I doubt that thread will help much - it basically ends up by saying "use PrintForm", and in this case we have been told it doesn't work.

I think we really need to clarify exactly what is being asked here, as the original post was a bit cryptic.

Please correct me if I'm wrong here, but as far as I can see you are actually asking the following two questions:
  1. PrintForm is not printing the image which is in a picturebox on the form - how to fix?
  2. The printout is too small - how do I expand it to the whole page?
Does this sound right?
Feb 8 '07 #5
arunbalait
164 100+
There are four label boxes at the top left corner and four label boxes at the top right corner of my form. And then nearer to the center of the form a picture box and at the bottom a command button to print. BY using PrintForm method if i take printout in a A4 sheet the whole form printed within Half of the page. So I want to format it to print in the entire paper as a neat format. Got it?

Thanx
Feb 8 '07 #6
Killer42
8,435 Expert 8TB
There are four label boxes at the top left corner and four label boxes at the top right corner of my form. And then nearer to the center of the form a picture box and at the bottom a command button to print. BY using PrintForm method if i take printout in a A4 sheet the whole form printed within Half of the page. So I want to format it to print in the entire paper as a neat format. Got it?
Thanks, that's much clearer.

I think you might have to print the controls yourself, to the Printer object. For example, here's a very crude Sub which you can pass a form to, and it will attempt to print all labels and picture boxes on the form... Have a play with this, you should be able to adjust the scaling and so on. When I tried it it worked, but came out a bit funny.
Expand|Select|Wrap|Line Numbers
  1. Public Sub PrintThisForm(frm As Form)
  2.   Dim ctl As Control
  3.   With Printer
  4.     .Orientation = vbPRORPortrait
  5.     Printer.Scale (0, 0)-(frm.ScaleWidth, frm.ScaleHeight)
  6.     For Each ctl In frm.Controls
  7.       If TypeOf ctl Is Label Then
  8.         .CurrentX = ctl.Left
  9.         .CurrentY = ctl.Top
  10.         .Font = ctl.Font
  11.         .ForeColor = ctl.ForeColor
  12.         Printer.Print ctl.Caption
  13.       ElseIf TypeOf ctl Is PictureBox Then
  14.         .PaintPicture ctl.Image, ctl.Left, ctl.Top
  15.       End If
  16.     Next
  17.     .EndDoc
  18.   End With
  19. End Sub
Feb 8 '07 #7
Killer42
8,435 Expert 8TB
It might also help to read some relevant articles such as Expand Your VB6 Printing Repertoire—Part I.
Feb 8 '07 #8
arunbalait
164 100+
ya thanx.. But I calculated the Horizontal and Veritcal margins and printed the cotrols. But I coulndt get clear formatting. Somehow nearer.
Feb 8 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Craig | last post by:
First of all, this one is driving me crazy, so thanks in advance for any help!! I've got a javascript function in a parent document that generates an HTML document on the fly when a button is...
6
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
0
by: vbmania | last post by:
Hello, I am going to print paper of 15 X 4 Inch. It's a continuous form. But When I Print Multiple Paper, Printer does'nt print back to back. If I am goint to print 3 pages. Jump over...
2
by: PJO | last post by:
I've got a Print menu item on a parent navigation form. How can I get it to print the contents of a RichTextBox located on a child form? TIA -Pat
4
by: Eric | last post by:
I have the following code on my ASPX (ASP 2.0) page: <head runat="server"> <meta content="text/VBScript" http-equiv="content-script-type" /> <title>Call duty</title> <script...
9
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the "DualFont" and use different fonts. By the way, how...
3
by: Steve Kershaw | last post by:
Hi, I need to print the contents (rows and columns) of a GridView to the default printer. Is there any way of doing this easly? Thanks Steve
0
by: sajjad2008 | last post by:
Hi Everyone! how to print specific contents of vb form in vb6. can someone give the code example please... actually, i want to draw a graph on vb6 form and then print it. please help....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.