Click here to Skip to main content
16,019,018 members

Comments by dj dourak (Top 4 by date)

dj dourak 30-Apr-12 13:34pm View    
Just in case someone finds it useful:
I disabled the relevant events by copying the appropriate line from the form.designer.cs file and using the appropriate sign. Plus to enable, minus to disable the event.
eg this.amBox.TextChanged += new System.EventHandler(this.amBox_TextChanged);
The above enables the event.
this.amBox.TextChanged -= new System.EventHandler(this.amBox_TextChanged);
Changing the + to - disables the event.
dj dourak 30-Apr-12 13:03pm View    
Silly me!
I used the step-into feature of the debugger and finally figured out what was going on...
I have a text-changed event for most of the textboxes, which is used to extract relevant data from the database and copy them to the datagridview control (its contents change as I type on the text-boxes or whenever the text changes inside the boxes for any reason) so I guess that I'll have to circumvent triggering the event before copying the rows...
dj dourak 30-Apr-12 11:55am View    
Thanks for the answer but I don't get it! Selection is declared as int and an integer is assigned to it... (GetFirstRow returns an int)
Setting the rows as parameters would definetly do the job, but I wanted to make the code more readable since there would be about 10 parameters then. I could also create a new object containing all the rows and use it as a parameter for manageSelection.
But the question is still unanswered, why can't I access dataGridView1.Rows... etc inside the method? I have to add that the messagebox displays the correct information which means that the info is there before calling manageSelection()
dj dourak 30-Apr-12 7:48am View    
I've already done that and the Rows.Count value is indeed less inside the method. The question is why does this happen? Can I avoid it without creating new objects or deleting the method and inserting duplicate code in the appropriate event-handlers?