Hi Everyone,
I'm getting (Index was out of range error.Must be non-negative and less than the size of the collection)error while taking print from Gridview data.
Here is my code can anyone tell me what's wrong with my code?
Code Which I've written under Print button method:
private void btnprint_Click(object sender, EventArgs e) { //Open the print dialog PrintDialog printDialog = new PrintDialog(); printDialog.Document = printDocument1; ; printDialog.UseEXDialog = true; //Get the document if (DialogResult.OK == printDialog.ShowDialog()) { printDocument1.DocumentName = "Test Page Print"; printDocument1.Print(); }
}
Code which I've written under printdocument control method: