954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Print a form without using report

Hello,

I am developing an application in Visual Basic in which i have to enter the details of candidates and after that clicking on the print button, the details of that particular candidate get printed out without using/going to a report.
I want to know how can i do that, also i don't know anything about print command in visual basic. so, if anyone can explain me about this too.

Thanks in advance.

Es Sayen
Newbie Poster
19 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

try this code..

Printer.print "Message"
printer.enddoc

this will directly print your text to the printer attached.( just be sure to configure the printer in the control panel) try exploring the Printer class and you can see it works.. change the CurrentX and currentY values to positon your text.

vbCNEW
Light Poster
44 posts since Apr 2007
Reputation Points: 10
Solved Threads: 3
 

A better and most easy way to get something printed on to the printer is the following code.

Dim Str1 As String
Open "LPT1" For Output As #1
Str1="Testing the Printer"
Line Output #1 Str1
Close #1

AV Manoharan
Junior Poster
166 posts since Jun 2007
Reputation Points: 10
Solved Threads: 9
 

[quote=AV Manoharan;387915]A better and most easy way to get something printed on to the printer is the following code.

Dim Str1 As String
Open "LPT1" For Output As #1
Str1="Testing the Printer"
Line Output #1 Str1
Close #1

hello manoharan,

can you make me understand this code. or just let me know what is #1 stand for.
also, if this code will work to print the candidate details. and one more thing from where i can get notes on vb print command/ statement to understand it fully and better.

Thank you.

Es Sayen
Newbie Poster
19 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

Hello to all,

what should i do if i want to open the print dialog box to see which printer is attached and to change the given preferences of printer etc. by clicking on the button placed on the form.

Thanks to both of you for previos replies.

Es Sayen
Newbie Poster
19 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

your welcome... actually your last problem is easy to solve... me myself have no idea how before you raise that question... all u hav to do is search into the net.. try goggle!!! its easy really..

so heres the link for you..
http://www.samspublishing.com/library/content.asp?b=STY_VB6_24hours&seqNum=132&rl=1

im willing to help but maybe next time try to solve it first before asking for any help..

ok??? pls dont be offended..

vbCNEW
Light Poster
44 posts since Apr 2007
Reputation Points: 10
Solved Threads: 3
 

Hello vbcnew,

Thanks for your reply.
I 'll look at what you said.

Es Sayen
Newbie Poster
19 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You