By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

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

hussaini
P: 24
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
Apr 27 '07 #1
Share this Question
Share on Google+
5 Replies


Expert 5K+
P: 8,434
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).
May 1 '07 #2

hussaini
P: 24
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
May 1 '07 #3

Expert 5K+
P: 8,434
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.
May 1 '07 #4

hussaini
P: 24
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
May 24 '07 #5

Expert 5K+
P: 8,434
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.)
May 24 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.