Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
QuestionMessage Removed Pin
13-Aug-10 11:53
Tichaona J13-Aug-10 11:53 
AnswerRe: Playing a list of files on after the other. Pin
AspDotNetDev13-Aug-10 12:22
protectorAspDotNetDev13-Aug-10 12:22 
QuestionHow to properly show text for URL link using RichTextBox to output into RTF format? Pin
jboyd11113-Aug-10 10:53
jboyd11113-Aug-10 10:53 
QuestiondataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB13-Aug-10 10:27
MumbleB13-Aug-10 10:27 
AnswerRe: dataGridView1_CellContentClick Error Index Out of Range Pin
OriginalGriff13-Aug-10 10:39
mveOriginalGriff13-Aug-10 10:39 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB13-Aug-10 11:02
MumbleB13-Aug-10 11:02 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB13-Aug-10 11:18
MumbleB13-Aug-10 11:18 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
OriginalGriff13-Aug-10 22:59
mveOriginalGriff13-Aug-10 22:59 
Kwagga wrote:
I have also re-writtent the currentRow as this which seems to work:
int currentRow = e.RowIndex;


Yes, that is what I would expect - and int assigned directly to an int! See how much easier it is when you don't convert int to string to int? Laugh | :laugh:

Kwagga wrote:
The error seems to come in here:
string taskstring = dataGridView1[0, currentRow].Value.ToString();


That only leaves one option: currentRow has a value that is either negative, or too big for the DataGridView. Since you access it from the RowIndex, it is unlikely to be too big - how would it unless the DatatGridView is being modified by some outside agency; not too likley in your scenario I think.

That leaves negative. And I'm betting that is what the problem is. The easiest way to get a negative number here via the RowIndex (in fact the only one I know, but I've been wrong before) is to click on the column header. Are you by any chance doing that?

If not, then insert a check for negative (and out-of-range) values and see what you get.

I'm pretty confident that either your code for the other DataGridViews is different and checks for valid data or you haven't clicked on their column header yet... Big Grin | :-D
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB14-Aug-10 3:41
MumbleB14-Aug-10 3:41 
AnswerRe: dataGridView1_CellContentClick Error Index Out of Range Pin
Luc Pattyn13-Aug-10 14:00
sitebuilderLuc Pattyn13-Aug-10 14:00 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB13-Aug-10 21:50
MumbleB13-Aug-10 21:50 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
Luc Pattyn13-Aug-10 22:34
sitebuilderLuc Pattyn13-Aug-10 22:34 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
OriginalGriff13-Aug-10 23:03
mveOriginalGriff13-Aug-10 23:03 
AnswerRe: dataGridView1_CellContentClick Error Index Out of Range Pin
Luc Pattyn13-Aug-10 23:13
sitebuilderLuc Pattyn13-Aug-10 23:13 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
OriginalGriff13-Aug-10 23:22
mveOriginalGriff13-Aug-10 23:22 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB14-Aug-10 4:18
MumbleB14-Aug-10 4:18 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
OriginalGriff14-Aug-10 6:06
mveOriginalGriff14-Aug-10 6:06 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
MumbleB14-Aug-10 10:00
MumbleB14-Aug-10 10:00 
GeneralRe: dataGridView1_CellContentClick Error Index Out of Range Pin
OriginalGriff14-Aug-10 23:50
mveOriginalGriff14-Aug-10 23:50 
QuestionReturn a specified item from a list box.. Pin
Tichaona J13-Aug-10 8:57
Tichaona J13-Aug-10 8:57 
AnswerRe: Return a specified item from a list box.. Pin
OriginalGriff13-Aug-10 9:06
mveOriginalGriff13-Aug-10 9:06 
GeneralRe: Return a specified item from a list box.. Pin
Ravi Bhavnani13-Aug-10 9:15
professionalRavi Bhavnani13-Aug-10 9:15 
GeneralRe: Return a specified item from a list box.. Pin
Luc Pattyn13-Aug-10 9:28
sitebuilderLuc Pattyn13-Aug-10 9:28 
GeneralRe: Return a specified item from a list box.. Pin
Ravi Bhavnani13-Aug-10 9:31
professionalRavi Bhavnani13-Aug-10 9:31 
GeneralRe: Return a specified item from a list box.. Pin
Luc Pattyn13-Aug-10 9:34
sitebuilderLuc Pattyn13-Aug-10 9:34 

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.