Link to home
Start Free TrialLog in
Avatar of luthar
luthar

asked on

Print the content of a label?

Hello,

I have dumped some text in a label and wish to print it. Is it possible or do i have to use a RTB? if is it could you plz give some code, info on how to do it.

Thanks in advance

Luthar
Avatar of Crin
Crin

Hello luthar,

What do you mean by "print"? And what distinguishes in this case between RTB and Label?

You could access Label.Caption property or RichTextBox.Text or RichTextBox.RTFText properties...

so...

is
Debug.Print Me.Label1.Caption
the answer?

Sincerely yours,

Crin

PS. Sorry, English is not my native language... :(
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of luthar

ASKER

Sry i should have been more clear in my question.

I wish to send the content of my label to my printer so i get a printed document that has all the characters my label had.


hope it's clearer...
Yes, Ark is absolete right

Printer.Print Me.Label1.Caption

(Also me :) one thing - I had posted code to print to debug window :))

Sincerely,

Crin
Private Sub Form_Click()
Printer.Print Label1.Caption
End Sub

Private Sub Form_Load()
Label1.Caption = "VALERA" & Chr(13) & Chr(10) & _
"DAMN"
End Sub
Avatar of luthar

ASKER

Umm i've tried your code and it works...well sort of..

The printing only starts when i quit my program...any idea why?
Avatar of luthar

ASKER

Nevermind...i forgot to add printer.enddoc :D

thx :)
Printer.Enddoc
Use:
Printer.Print Label1.Caption
Printer.EndDoc

Regards.
If you want to create a document, something like word makes it is not enough to use a simple label. You have to use the printer object (or  a crystalreport control etc.) to do this. If you just send something to the printer...well it's not enough if you want to make something beautiful. I will help for you with that if you want. If not luthar's and kamall's answer is absolutely correct.