Connecting Tech Pros Worldwide Forums | Help | Site Map

please tell me any 1 printing code in datagrid in visual basic 6

hussaini's Avatar
Newbie
 
Join Date: Dec 2006
Location: pakistan nawabshah
Posts: 24
#1: Apr 27 '07
please tell me any 1 printing code in datagrid in visual basic 6

in detail -----
Hello seniors members hope u will tell me ..... i have created a form in visual basic 6 so in the form there is a datagrid and a command button so i want to print the records in datagrid when i press that command button it open dailog like ms word CTRL + P its open of printing dailog hope u understand what i meant

Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#2: May 1 '07

re: please tell me any 1 printing code in datagrid in visual basic 6


Quote:

Originally Posted by hussaini

please tell me any 1 printing code in datagrid in visual basic 6

in detail -----
Hello seniors members hope u will tell me ..... i have created a form in visual basic 6 so in the form there is a datagrid and a command button so i want to print the records in datagrid when i press that command button it open dailog like ms word CTRL + P its open of printing dailog hope u understand what i meant

I don't remember (if I ever knew) how to print stuff from a datagrid. But the print dialogue is easily produced by the Common Dialog control (go to Project | Components and add Microsoft Common Dialog Control).
hussaini's Avatar
Newbie
 
Join Date: Dec 2006
Location: pakistan nawabshah
Posts: 24
#3: May 1 '07

re: please tell me any 1 printing code in datagrid in visual basic 6


Quote:

Originally Posted by Killer42

I don't remember (if I ever knew) how to print stuff from a datagrid. But the print dialogue is easily produced by the Common Dialog control (go to Project | Components and add Microsoft Common Dialog Control).

ok thanx for replying me any way do u know the coding of printing command
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#4: May 1 '07

re: please tell me any 1 printing code in datagrid in visual basic 6


Quote:

Originally Posted by hussaini

ok thanx for replying me any way do u know the coding of printing command

In VB6, you generally use the Printer object. You print to it much the same as to a picturebox or whatever by using the .Print, .Circle, .Line and other methods and setting font properties and so on, but with the addition of things like the .NewPage method to perform a pagebreak, and .EndDoc method to finish building/spooling the document and start physically printing it.
hussaini's Avatar
Newbie
 
Join Date: Dec 2006
Location: pakistan nawabshah
Posts: 24
#5: May 24 '07

re: please tell me any 1 printing code in datagrid in visual basic 6


Quote:

Originally Posted by Killer42

In VB6, you generally use the Printer object. You print to it much the same as to a picturebox or whatever by using the .Print, .Circle, .Line and other methods and setting font properties and so on, but with the addition of things like the .NewPage method to perform a pagebreak, and .EndDoc method to finish building/spooling the document and start physically printing it.

i think you dont understand what i meant i want to print records in datagrid when we just like Ctrl+P the dailog box will open of print just simple the print code
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#6: May 24 '07

re: please tell me any 1 printing code in datagrid in visual basic 6


Quote:

Originally Posted by hussaini

i think you dont understand what i meant i want to print records in datagrid when we just like Ctrl+P the dailog box will open of print just simple the print code

I guess I still don't understand, because as far as I can tell all you need do is use the Common Dialog control to provide a print dialogue, and the Printer object to send your information to the printer. I don't think the datagrid control has any properties or methods which relate directly to printing, it's concerned with displaying stuff on-screen.

Why can't you just loop through the records in the datagrid, and print each of them to the Printer object?

(Or perhaps you should look into using something like Crystal Reports.)
Reply


Similar Visual Basic 4 / 5 / 6 bytes