[RESOLVED] Need to print data inside Frame control
I am designing an application in which i added 200 text boxes into a frame control. On clicking a button, all the values in the text boxes must be printed in a paper by a printer connected to the computer. Somebody please help me with the code. Thanks in advance
Re: Need to print data inside Frame control
Try
Code:
Dim Contrl As Control
For Each Contrl In Me.Controls
If (TypeOf Contrl Is TextBox) Then
If Contrl.Container.Name = "Frame1" Then
Printer.Print Contrl.Text
End If
End If
Next
Printer.EndDoc
Re: Need to print data inside Frame control
Mr.Hack. Thank u for ur help. My 200 text boxes are in the form of 20 x 10 matric. When i use ur code the data in the text boxes are printed one below the other. But i need to print the data in the 20 x 10 matriX itself. How to do it?
Re: Need to print data inside Frame control
Can you just print the form itself?
Re: Need to print data inside Frame control
I want to print only the text boxes. The text boxes are inside a Frame. Atleast if i print the whole frame control, along with the text boxes,its enough.
Re: Need to print data inside Frame control
May be something like this will help ?
Code:
dim i as long
dim Temp as string
Dim Contrl As Control
For Each Contrl In Me.Controls
If (TypeOf Contrl Is TextBox) Then
If Contrl.Container.Name = "Frame1" Then
if i<5 then '~~~ for columns
temp=temp & vbtab & Contrl.Text
i=i+1
else
'~~~ resetting values
i=0
temp=""
Printer.Print temp
temp=temp & vbtab & Contrl.Text
i=i+1
end if
End If
End If
Next
Printer.EndDoc
(untested code) :wave:
Re: Need to print data inside Frame control
Is there anyway to print only a portion of the form? If so its easy to find the co-ordinates of the Frame and print the entire form within that co-ordinate.
Re: Need to print data inside Frame control
if you change your frame to a picturebox, it will appear very similar indeed and it is much easier to print the contents of a picturebox
see this example from microsoft about fitting print to page size
http://support.microsoft.com/default...b;en-us;161299
Re: Need to print data inside Frame control
Mr.Hack, i have changed my mind:(. Now its enough to print the form itself. Help me with code to print the entire form.
Re: Need to print data inside Frame control
Quote:
Originally Posted by
ttsdinesh
Mr.Hack, i have changed my mind:(. Now its enough to print the form itself. Help me with code to print the entire form.
Code:
Private Sub Command1_Click()
Form1.PrintForm
End Sub
.......:wave:
Re: Need to print data inside Frame control
Thank u Mr.akhileshbc, Mr.westconn1 and Mr.Hack. I used
Code:
Private Sub Command1_Click()
Form1.PrintForm
End Sub
and solved my problem. Thanks for ur efforts. :wave:
Re: [RESOLVED] Need to print data inside Frame control
We are happy to help you...:wave: