Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » General Visual Basic » Print in DOS mode (VB6)


Print in DOS mode (VB6)Expand / Collapse
Author
Message
Posted 6/7/2008 9:58:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/25/2008 6:52:46 AM
Posts: 3, Visits: 11
Hi

Iam preparing a report on VB6. I wish to have my report printed in the DOS mode using a DotMatrix printer.

How will I do it, since Iam not working on the command prompt. Is there any way to solve this issue? Are there any general rules irrespective of the tools used to undertake such printing ?

Any help/suggestion in this regard would be highly appreciated.

Regards

ARIJIT

A.R.I.J.I.T.T.H.E.N.E.T.M.O.R.O.N.

Post #25139
Posted 6/7/2008 10:31:13 AM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: 10/18/2012 11:40:00 AM
Posts: 548, Visits: 2,556
Someone else is going to have to give you the particulars but you can run DOS by Shelling it.

Shell ("CMD.exe"), vbNormalFocus


________________________________________________________________ 

"So much to learn. So little time to do it. Wise men know it's later than one thinks"!

Mark's Syntax.Zip    Pause Sub

I don't answer programming questions via PMs. That's what the forum is for! 

Post #25140
Posted 6/8/2008 4:05:34 PM


Forum God

Forum God

Group: Moderators
Last Login: 10/8/2014 9:46:56 PM
Posts: 1,908, Visits: 5,509
Welcome to A1vbcode ArijitM

I see your other two posts are in VB.Net but this one you say you are using VB6.

DOS label Printing using VB

How To Send Raw Data to a Printer Using the Win32 API from Visual Basic

Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Post #25145
Posted 6/13/2008 6:43:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/24/2008 7:23:12 AM
Posts: 5, Visits: 7
Try this

 Open "c:\prnx.txt" For Output As #1

 print #1, "    Test Print ..."

 print #1,  " Next lines"

 close #1

Note :

make sure ur printer is power on !

U can add some ....

if u want Bold Letter ..

print #1, chr(27)+'W1'+"HEADING"+CHR(27)+'W0'

doube strike print...

print #1, chr(27)+'E'+"HEADING"+CHR(27)+'F'

Regards

Gopinath

Post #25180
Posted 6/13/2008 6:45:12 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/24/2008 7:23:12 AM
Posts: 5, Visits: 7
Open "c:\prnx.txt" For Output As #1

This will create a file name .... Prx.txt in  Cdrive

Direct to Printer ...

Open "c:\prn.txt" For Output As #1

Post #25181
Posted 6/13/2008 7:12:14 AM


Forum God

Forum God

Group: Moderators
Last Login: 10/8/2014 9:46:56 PM
Posts: 1,908, Visits: 5,509
gopinath (6/13/2008)

 Open "c:\prnx.txt" For Output As #1

 print #1, "    Test Print ..."

 print #1,  " Next lines"

 close #1

That won't print anything to a printer that will just print "    Test Print ..." and " Next lines" to c:\prnx.txt. Print is a VB command to send data to a file not to print a file.

I think there are some DOS command you can use something like

prn c:\prnx.txt

But you would have to do a web search to find the exact info.

Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Post #25182
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 9:28am