Click here to Skip to main content
15,921,793 members
Home / Discussions / C#
   

C#

 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 15:39
professionalBillWoodruff20-Jun-17 15:39 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
Eddy Vluggen21-Jun-17 3:45
professionalEddy Vluggen21-Jun-17 3:45 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Bernhard Hiller19-Jun-17 22:46
Bernhard Hiller19-Jun-17 22:46 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 6:44
professionalBillWoodruff20-Jun-17 6:44 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Richard Deeming20-Jun-17 0:50
mveRichard Deeming20-Jun-17 0:50 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 6:50
professionalBillWoodruff20-Jun-17 6:50 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Gerry Schmitz21-Jun-17 3:15
mveGerry Schmitz21-Jun-17 3:15 
QuestionRemoving an element from the content of a string value which is HTML code Pin
Farhad Eft19-Jun-17 1:55
Farhad Eft19-Jun-17 1:55 
AnswerRe: Removing an element from the content of a string value which is HTML code Pin
OriginalGriff19-Jun-17 2:12
mveOriginalGriff19-Jun-17 2:12 
GeneralRe: Removing an element from the content of a string value which is HTML code Pin
Farhad Eft19-Jun-17 2:46
Farhad Eft19-Jun-17 2:46 
GeneralRe: Removing an element from the content of a string value which is HTML code Pin
OriginalGriff19-Jun-17 2:55
mveOriginalGriff19-Jun-17 2:55 
QuestionWindows media player issue Pin
Member 1326418716-Jun-17 20:37
Member 1326418716-Jun-17 20:37 
AnswerRe: Windows media player issue Pin
OriginalGriff16-Jun-17 21:34
mveOriginalGriff16-Jun-17 21:34 
QuestionChanging an Image during runtime from resources Pin
Member 1319657416-Jun-17 5:10
Member 1319657416-Jun-17 5:10 
AnswerRe: Changing an Image during runtime from resources Pin
BillWoodruff17-Jun-17 13:12
professionalBillWoodruff17-Jun-17 13:12 
QuestionSystem.IndexOutOfRangeException Pin
joost.versteegen14-Jun-17 21:46
joost.versteegen14-Jun-17 21:46 
AnswerRe: System.IndexOutOfRangeException Pin
OriginalGriff14-Jun-17 22:19
mveOriginalGriff14-Jun-17 22:19 
GeneralRe: System.IndexOutOfRangeException Pin
joost.versteegen14-Jun-17 22:26
joost.versteegen14-Jun-17 22:26 
GeneralRe: System.IndexOutOfRangeException Pin
OriginalGriff14-Jun-17 22:38
mveOriginalGriff14-Jun-17 22:38 
GeneralRe: System.IndexOutOfRangeException Pin
joost.versteegen14-Jun-17 22:41
joost.versteegen14-Jun-17 22:41 
GeneralRe: System.IndexOutOfRangeException Pin
OriginalGriff14-Jun-17 23:01
mveOriginalGriff14-Jun-17 23:01 
GeneralRe: System.IndexOutOfRangeException Pin
joost.versteegen14-Jun-17 23:08
joost.versteegen14-Jun-17 23:08 
AnswerRe: System.IndexOutOfRangeException Pin
Richard Deeming15-Jun-17 1:39
mveRichard Deeming15-Jun-17 1:39 
That looks like a bug in the framework.

According to this post from 2011[^], you should be able to work around it by creating a new list if the existing list is empty when you add the new item:
C#
if (_SelectedDrum.Defects.Count == 0)
{
    _SelectedDrum.Defects = new List<DrumDefect> { defect };
    
    dataGridViewDefects.DataSource = null;
    dataGridViewDefects.DataSource = _SelectedDrum.Defects;
    dataGridViewDefects.Refresh();
}
else
{
    _SelectedDrum.Defects.Add(defect);
}

Or there's this StackOverflow answer[^] which suggests using a BindingList<T> instead of a List<T>.

If you can reproduce the problem with a simple example application, it might be worth reporting the bug on Connect[^] to see if it can be fixed in a future version.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: System.IndexOutOfRangeException Pin
joost.versteegen15-Jun-17 2:14
joost.versteegen15-Jun-17 2:14 
AnswerRe: System.IndexOutOfRangeException Pin
Gerry Schmitz16-Jun-17 5:47
mveGerry Schmitz16-Jun-17 5:47 

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.