Hi, i had write the following code but it seems like gt exception, can help me check got what problem?

 Dictionary<string, double> sortList4 = new Dictionary<string, double>();
 List<double> list = ISUPP.Items.OfType<double>().ToList();                                                      
                double[] value1=list.ToArray();
                int c = 0;
                foreach (string gk in Comset2.Items)
                {
                    sortList4.Add(gk, value1[0]);
                    c++;
                }

hmmm...
Comset2 is what? Where do you inizialize it? What kind of collection is it?

This line

sortList4.Add(gk, value1[0]);

is going to assign the same value to every entry in your list. Did you mean to say

sortList4.Add(gk, value1[c]);

?

Oh, sorry, i post wrong, see codes below:

            List<double> list = ISUPP.Items.OfType<double>().ToList();                                                      
            double[] value1=list.ToArray();
             foreach (string gk in Comset2.Items)
                {
                    sortList4.Add(gk,1);
                }

            int c = 0;
                foreach (string myKey in sortList4.Keys)
                {                       
                        double Count = (double)sortList4[myKey];
                        sortList4[myKey] =value1[0] ;                          
                        c++;                      
                }

Comset and ISUPP are listbox, the content of ISUPP are:

1
1
1
1
1
1
1
//something like that

i already change to value1[c], but still the same, got ecxception thr..

Two things:
Use [code] [/code] tags around your code. It makes it much easier to read and refer to.
What exception and what line is throwing the exception?

Lol, this post isnt good either.
Find out way by your self.


a tip: i have an issue with this code:

data = table.Rows[i]["Name"];
if(data < 10 ? _value1 + 2 : _value2 - 2;

If you find out what would be probem here, then I will find whats the matter in your code.

The problem is around the codes below:

int c = 0;
foreach (string myKey in sortList4.Keys)
{ 
double Count = (double)sortList4[myKey];
sortList4[myKey] =value1[0] ; 
c++; 
}

when i execute here, it will jump to my catch statement..
//my catch statement
catch (Exception)
{
MessageBox.Show("Please put only numbers");

}

List<double> list = ISUPP.Items.OfType<double>().ToList();
Or got any method to pass the list to the sortList4 (value)?

Oh ya, the line throw the exception is here:

sortList4[myKey] =value1[c] ;

when program until here , it will jump out to catch..