Hi guys thought I would post this just in case it helps others. Market Start Times can change throughout the day which does make sense as there could be a good reason. It just took me a while to realise this 
I grab the Market Catalog (racing) when my Bot starts and normally ask for the next 2 hours in advance. Then while my bot is running I request updates of the MC every 30 minutes. When I get the new MC i compare it to my old MC and if I have overlapping data then I use the most recent up to date data.
I to have a routine which displays the list of Market IDs with Times To Go in a checked list box with a countdown every second however I always note that later on during the day the TTG would not be ascending and would be out of whack, ie:
Market A Starting 8:50 Should be shown after Market D
Market B Starting 4:54
Market C Starting 5:55
Market D Starting 6:22
So to overcome changes in Markets TTG and display each market ID in ascending Time To Go order I just sort the Market Starttimes in an array and then loop though this array ie:
Then I loop through the SortMarketTimeToGo() array and if the TTG matches a market in my myBFdata.MARKETCATALOG() array I display it. The only thing i need to do is check that I am not adding a market id twice. I also check whether the market id is a WIN or PLACE market ID and if it is a PLACE market ID then I get the WIN market ID first and display that before the PLACE ID.
Was going to upload an attachment but can't get them to work - I get an image resize error ??????

I grab the Market Catalog (racing) when my Bot starts and normally ask for the next 2 hours in advance. Then while my bot is running I request updates of the MC every 30 minutes. When I get the new MC i compare it to my old MC and if I have overlapping data then I use the most recent up to date data.
I to have a routine which displays the list of Market IDs with Times To Go in a checked list box with a countdown every second however I always note that later on during the day the TTG would not be ascending and would be out of whack, ie:
Market A Starting 8:50 Should be shown after Market D
Market B Starting 4:54
Market C Starting 5:55
Market D Starting 6:22
So to overcome changes in Markets TTG and display each market ID in ascending Time To Go order I just sort the Market Starttimes in an array and then loop though this array ie:
Code:
Dim SortMarketTimeToGo(0 To myBFdata.MARKETCATALOG.Count - 1) As Date
For mcIdx As Integer = 0 To myBFdata.MARKETCATALOG.Count - 1
SortMarketTimeToGo(mcIdx) = myBFdata.MARKETCATALOG(mcIdx).MarketStartTime
Next mcIdx
Array.Sort(SortMarketTimeToGo)
Code:
'LOOP THROUGH THE TIMES TO GO WHICH WILL NOW BE IN ASENDING ORDER
For sortedIdx As Integer = 0 To SortMarketTimeToGo.Count - 1
'LOOP THROUGH THE MARKET CATALOG AND IF DISPLAY ANY MARKETS WHICH MATCH THIS TIME TO GO
For mcIdx As Integer = 0 To myBFdata.MARKETCATALOG.Count - 1
If myBFdata.MARKETCATALOG(mcIdx).MarketStartTime = SortMarketTimeToGo(sortedIdx) Then
<code to display market id and TTG in checked list box>

