• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Command in VB 6 ?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.
It realy depends on what you want to print, and how you want the print formated. The general print statement would go like this (assume the ok button is named CmdOK)

private sub CmdOK_Click()
form1.printform
End sub

This will print the entire form. If you are trying to print say a Rich text box on the form it would look something like

Private sub CmdOK_Click()
RichTextBox1.SelPrint (printer.hDC)
End Sub

This uses the windows printer file (printer.hDC) that stores all the available printers to send the text inside the rich text box to the default windows printer.

The MSDN library has a lot of good info on printing. If you dont have it installed you can also search it at www.msdn.microsoft.com
 
Thanks !

Now, only one other question, how do I open a different file ? In exemple, if I create a menu (autorun) on a CD that lets the user open other applications. What should the code be ? (for an application or/and an video file : *.exe or/and *.avi ...)

Thanks !
 
If you mean running a file from code, then the Shell statement is what you're after.

For example,

Shell "notepad.exe"

should (this is from memory but hey! check the help files) start up a new instance of notepad. Similarly:

Shell "budget.xls"
Shell "movie.avi"

Should open the programs that are associated with those file types and then open that file.
 
Back