Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Counting duplicate values > X

$
0
0

I have some real time data being passed in a listbox as a string.

I need to find duplicate values that are > x then I need to count how many instances of values > x

Eventually I want to send an email if the number X is present in the list box > x times.


void m_TTInstrNotify_OnPriceListUpdate(TTInstrNotify pNotify)
        {
            try
            {
                if (pNotify != null)
                {
                    string sMsg = null;
                    string ltp = null;
                    string ltq = null;

                    foreach (ITTPriceUpdate priceUpdate in pNotify.PriceList)
                    {
                        foreach (ITTPriceEntry priceEntry in priceUpdate)
                        {
                            switch (priceEntry.PriceID)
                            {
                                case enumPriceID.ttLastTradedPrice:
                                    ltp = priceEntry.toString();
                                    break;
                                case enumPriceID.ttLastTradedQty:
                                    ltq = (string)priceEntry.toString();
                                    break;
                            }
                        }

                        string timestamp = priceUpdate.TimeStamp.Substring(0, 8);
                        sMsg = timestamp + "   " + ltp + "   " + ltq;
                        ts.Items.Add(sMsg);
                        m_Cnt = m_Cnt + 1;

Just a little stuck.


Viewing all articles
Browse latest Browse all 12583

Trending Articles