TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
cad sunny
NA
138
22.9k
Datagridview printing by user selecting rows and columns
Oct 5 2015 7:55 AM
Hi,
i want to print datagridview printing by user selecting rows and columns below code is only first and second rows and colomns text
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
System.Drawing.Font fntString = new Font("Times New Roman", 10, FontStyle.Bold);
//first row values
e.Graphics.DrawString("Id : ", fntString, Brushes.Black, 24, 70);
e.Graphics.DrawString(dataGridView1.Rows[0].Cells[0].Value.ToString(), fntString, Brushes.Black, 100, 70);
e.Graphics.DrawString("Name : ", fntString, Brushes.Black, 24, 90);
e.Graphics.DrawString(dataGridView1.Rows[0].Cells[1].Value.ToString(), fntString, Brushes.Black, 100, 90);
//second row values
e.Graphics.DrawString("Id : ", fntString, Brushes.Black, 180, 70);
e.Graphics.DrawString(dataGridView1.Rows[0].Cells[0].Value.ToString(), fntString, Brushes.Black, 220, 70);
e.Graphics.DrawString("Name: ", fntString, Brushes.Black, 180, 90);
e.Graphics.DrawString(dataGridView1.Rows[0].Cells[1].Value.ToString(), fntString, Brushes.Black, 220, 90);
}
Hide
Copy Code
i want to print like above code but selecting multiple or single row and colomns.
please help.iam stuck here.
thankyou
Reply
Answers (
2
)
Email verifier for valid email using smtp
ASP.net