Click here to Skip to main content
15,899,124 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to see datagrid print printpriview in c# windows. Pin
Henry Minute17-Sep-09 2:48
Henry Minute17-Sep-09 2:48 
The part of your code that is giving the error is
e.Graphics.DrawString(<big>this.dataGridView1(i, j)</big> + " ", f, b, j * 5, i * 5);


You are using this.dataGridView1(i, j) as if there were a DataGridView method that takes a row index and a column index and returns the value stored there. There is no such method.

You need to use square brackets '[]'.
Like this:
e.Graphics.DrawString(<big>this.dataGridView1[i, j]</big> + " ", f, b, j * 5, i * 5);

but as you have it you will get incorrect results, as it is dgrid[colindex, rowindex] and you are using dgrid[rowindex, colindex]

You can use something like
e.Graphics.DrawString(this.dataGridView1.Rows[i].Cells[j].Value.ToString() + " ", f, b, j * 5, i * 5);

so that you do not get confused about cols and rows.

Note also the .Value.ToString() in the last bit of code, you may, or may not need to use it in your code.

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

QuestionWindows Service Credentials Pin
Sangioo17-Sep-09 2:09
Sangioo17-Sep-09 2:09 
QuestionContext menu for a text box. Pin
Pavan Navali17-Sep-09 1:45
Pavan Navali17-Sep-09 1:45 
AnswerRe: Context menu for a text box. Pin
Not Active17-Sep-09 1:49
mentorNot Active17-Sep-09 1:49 
GeneralRe: Context menu for a text box. Pin
Pavan Navali17-Sep-09 18:26
Pavan Navali17-Sep-09 18:26 
GeneralRe: Context menu for a text box. Pin
Not Active18-Sep-09 1:43
mentorNot Active18-Sep-09 1:43 
Questiondisabled hyperlink and write arrow cursor Pin
Idoshhh17-Sep-09 1:17
Idoshhh17-Sep-09 1:17 
AnswerRe: disabled hyperlink and write arrow cursor Pin
Not Active17-Sep-09 1:53
mentorNot Active17-Sep-09 1:53 
Questionmeasure received data/s for an udp multicast address [modified] Pin
collapo17-Sep-09 1:08
collapo17-Sep-09 1:08 
AnswerRe: measure received data/s for an udp multicast address Pin
Luc Pattyn17-Sep-09 2:32
sitebuilderLuc Pattyn17-Sep-09 2:32 
GeneralRe: measure received data/s for an udp multicast address Pin
collapo17-Sep-09 3:16
collapo17-Sep-09 3:16 
GeneralRe: measure received data/s for an udp multicast address Pin
Luc Pattyn17-Sep-09 3:23
sitebuilderLuc Pattyn17-Sep-09 3:23 
GeneralRe: measure received data/s for an udp multicast address Pin
collapo17-Sep-09 4:17
collapo17-Sep-09 4:17 
QuestionAPI in C# Pin
vahid_erad17-Sep-09 0:54
vahid_erad17-Sep-09 0:54 
AnswerRe: API in C# Pin
Calla17-Sep-09 1:11
Calla17-Sep-09 1:11 
AnswerRe: API in C# Pin
Arun Jacob17-Sep-09 1:21
Arun Jacob17-Sep-09 1:21 
AnswerRe: API in C# Pin
Harvey Saayman17-Sep-09 1:52
Harvey Saayman17-Sep-09 1:52 
QuestionOmitting HTML footer ? Pin
Mohammad Dayyan17-Sep-09 0:47
Mohammad Dayyan17-Sep-09 0:47 
AnswerRe: Omitting HTML footer ? Pin
Not Active17-Sep-09 1:45
mentorNot Active17-Sep-09 1:45 
GeneralRe: Omitting HTML footer ? Pin
Mohammad Dayyan17-Sep-09 2:12
Mohammad Dayyan17-Sep-09 2:12 
GeneralRe: Omitting HTML footer ? Pin
Not Active17-Sep-09 2:34
mentorNot Active17-Sep-09 2:34 
QuestionTCP Socket issue Pin
Harvey Saayman17-Sep-09 0:43
Harvey Saayman17-Sep-09 0:43 
AnswerRe: TCP Socket issue Pin
harold aptroot17-Sep-09 3:17
harold aptroot17-Sep-09 3:17 
GeneralRe: TCP Socket issue Pin
Harvey Saayman17-Sep-09 3:26
Harvey Saayman17-Sep-09 3:26 
GeneralRe: TCP Socket issue Pin
harold aptroot17-Sep-09 3:30
harold aptroot17-Sep-09 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.