Hi,i am doing window form using VB C#.
My problem as below:

Dictionary<string, double> sortList1 = new Dictionary<string, double>();//contain key and //values

Dictionary<string, double> sortList2 = new Dictionary<string, double>();//empty


// do events                                                           

                int j = 0;
                foreach (double doub5 in sortList1.Values)
                {
                    holder = (doub5 * 100 / richTextBox2.Lines.Length) * bt;                      
                    j++;
                }      

i wants to store the keys of sortList1 and the new values (holder) into sortList2. How to do? Thanks you.

Impossibe in these kind of collections.
You cannot store type string into type of variable.
What do I mean: your 1st array has the string as for a key, and 2nd array`s Value is the double.
Chanage that. Then you simply code the key from array1 to the value of array2.

Do a loop of KeyValuePair<sting, double> of the dictionary1, and pass the key of the current to the value of the 2nd dictionary.

Mitja

If like that , is it possible to overwrite/replace the values of sortList1 with the new values(holder) on the Dictionary?

I means for each specific keys:
sortList1

Key Value
2 49
3 70
5 10
6 10

i want to replaces the value with new values (holder) for each specific key. holder is the values after compute by formula statement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.