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

C#

 
GeneralMessage Removed Pin
14-Aug-10 0:26
yum 201014-Aug-10 0:26 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
OriginalGriff14-Aug-10 2:01
mveOriginalGriff14-Aug-10 2:01 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
yum 201014-Aug-10 7:45
yum 201014-Aug-10 7:45 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
yum 201014-Aug-10 7:49
yum 201014-Aug-10 7:49 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
OriginalGriff14-Aug-10 8:49
mveOriginalGriff14-Aug-10 8:49 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
Luc Pattyn14-Aug-10 9:05
sitebuilderLuc Pattyn14-Aug-10 9:05 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
OriginalGriff14-Aug-10 9:24
mveOriginalGriff14-Aug-10 9:24 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
Luc Pattyn14-Aug-10 9:27
sitebuilderLuc Pattyn14-Aug-10 9:27 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
OriginalGriff14-Aug-10 9:35
mveOriginalGriff14-Aug-10 9:35 
GeneralRe: sever is not displaying the content that " you have left the chat room".... Pin
yum 201015-Aug-10 8:11
yum 201015-Aug-10 8:11 
QuestionGet cell value from GridView Pin
treuveni13-Aug-10 12:45
treuveni13-Aug-10 12:45 
AnswerRe: Get cell value from GridView Pin
PIEBALDconsult13-Aug-10 17:55
mvePIEBALDconsult13-Aug-10 17:55 
GeneralRe: Get cell value from GridView Pin
treuveni13-Aug-10 21:03
treuveni13-Aug-10 21:03 
AnswerRe: Get cell value from GridView Pin
maddahi.m.p14-Aug-10 0:29
maddahi.m.p14-Aug-10 0:29 
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 
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 
Luc, to start off, thanks for reference to your article. I have done that. Thumbs Up | :thumbsup:

As for cleaning up my code, I am doing that. Thumbs Up | :thumbsup:

As for your comment about being professional, a bit uncalled for but hey some peopl have bad days.

To explain the problem:

I have a form with a dataGridView on it. I also have a button on this form that loads the data grid with data from the Database. Only three columns: One is the ID column, which is an Autonumber, and the other two are Text columns. I am adding two extra columns to the dataGridView called Edit and Delete. Now, on the dataGridView1_CellContentClick event, when I click in any of the column/rows to edit data, I get an error. Full error message being, Index was out of range. Must be non-negatuve and less than the size of the collection. Parameter name: Index".

Below is the code:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
    int currentRow = e.RowIndex;
    int rowint = 0;
    dt.Clear();

    try
    {
        conn.Open();

        string taskstring = dataGridView1[0, currentRow].Value.ToString(); //This is where the error is.

In the above code, when a user clicks on a cell to edit the contents, the code has to do a check to see if the selected cell is an Edit or Delete Button Column. What seems to happen is that when I run this now, this morning in debug with a line break at the point where I get the error it seems to work. When running it in debug without the line break it does the following. Some times it selects the cell and other times it doesn't. However, it doesn't seem to be throwing the error. Cry | :((
Excellence is doing ordinary things extraordinarily well.

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.