<newbie> printing contains of a form

J

Jeff

..NET 2.0

I have created a form which contains one DataGridView and 2 buttons ("OK",
"Print")

When clicking on the "Print" button I want the contains of the DataGridView
to be printed. In addition the form has some info about the DataGridView
contents in it's title ("helloworld - [1223]")... How do construct the
printed page so that this number also get printed out.

Please give me some suggestions?

Jeff
 
F

Fabio

Jeff said:
.NET 2.0

I have created a form which contains one DataGridView and 2 buttons ("OK",
"Print")

When clicking on the "Print" button I want the contains of the
DataGridView to be printed. In addition the form has some info about the
DataGridView contents in it's title ("helloworld - [1223]")... How do
construct the printed page so that this number also get printed out.

Please give me some suggestions?

You can use my little report engine to design and print your data:
http://www.devbox4.net/?q=myneoreport
 
J

Jeff

Thanks for your suggestion. If possible I would like to use classes already
provided in .net

I've notice that .net have a PrintDocument class, maybe I can use that
class?

private void button2_Click(object sender, EventArgs e)
{
PrintDocument print = new PrintDocument();
print.PrintPage += new PrintPageEventHandler(this.print_PrintPage);
}

private void print_PrintPage(object sender, PrintPageEventArgs ev)
}
}

This code gives 2 errors:
; expected (at private void print_PrintPage(object sender,
PrintPageEventArgs ev) )
Type or namespace definition, or end-of-file expected

The code-behind file has more code too, but if I remove the code above then
everything compiles successfully.

any suggestions about what I'm doing wrong?



Fabio said:
Jeff said:
.NET 2.0

I have created a form which contains one DataGridView and 2 buttons
("OK", "Print")

When clicking on the "Print" button I want the contains of the
DataGridView to be printed. In addition the form has some info about the
DataGridView contents in it's title ("helloworld - [1223]")... How do
construct the printed page so that this number also get printed out.

Please give me some suggestions?

You can use my little report engine to design and print your data:
http://www.devbox4.net/?q=myneoreport
 
J

Jeff

I've fixed that compile error, the print_PrintPage method has }} instead of
{}



Jeff said:
Thanks for your suggestion. If possible I would like to use classes
already provided in .net

I've notice that .net have a PrintDocument class, maybe I can use that
class?

private void button2_Click(object sender, EventArgs e)
{
PrintDocument print = new PrintDocument();
print.PrintPage += new PrintPageEventHandler(this.print_PrintPage);
}

private void print_PrintPage(object sender, PrintPageEventArgs ev)
}
}

This code gives 2 errors:
; expected (at private void print_PrintPage(object sender,
PrintPageEventArgs ev) )
Type or namespace definition, or end-of-file expected

The code-behind file has more code too, but if I remove the code above
then everything compiles successfully.

any suggestions about what I'm doing wrong?



Fabio said:
Jeff said:
.NET 2.0

I have created a form which contains one DataGridView and 2 buttons
("OK", "Print")

When clicking on the "Print" button I want the contains of the
DataGridView to be printed. In addition the form has some info about the
DataGridView contents in it's title ("helloworld - [1223]")... How do
construct the printed page so that this number also get printed out.

Please give me some suggestions?

You can use my little report engine to design and print your data:
http://www.devbox4.net/?q=myneoreport
 
H

Hitech

Jeff, did you get a solution to this problem? Just curious to know how
you managed to implement it.

TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top