Hi all
I'm totaling up a list of items in a Binding source and I am just having a small problem with syntax for incrementing the value of a key if it already exists
any help is greatly appreciated line 16 below
C# Code:
SortedList mySortedList = new SortedList(); foreach (DataRowView view in myBindingSource) { if ((string)view["group_name"] == "USAT-Desktop") { view["group_name"] = "TEST TEST"; } if (mySortedList.Contains(view["category_name"])== false) { mySortedList.Add(view["category_name"], 1); } else { //how do I ++ the value of the key if it already exists? //mysortedlist[view["category_name"]].value +=1? }




Reply With Quote