c# arrays

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

c# arrays

Postby robcpettit » Thu Mar 13, 2008 9:27 am

Hi, my terminology may be wrong but i hope you get the jist. Ok, in c# vs2005 Im referencing the com interface. Ive added
BettingAssistantCom.Application.ComClass ba = new BettingAssistantCom.Application.ComClass();
private ArrayList prices = new ArrayList();. Then Im adding prices to my array with prices.Add(ba.getPrices()); I can see the elements in my array, normally I can loop through the elements, and although I can do here I cant work out how to get the values out, backmoney3, backmoney2 etc. I think Im supposed to do something like prices[i].-----, but I dont see these. Any ideas.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby GaryRussell » Thu Mar 13, 2008 12:48 pm

getPrices() returns an array.

I don't use C#, but imagine it's something like the following.

private object prices[];
prices=ba.getPrices();

You should be able to refer to the first back price as follows.

double backPrice=prices[0].backOdds1;
User avatar
GaryRussell
Site Admin
 
Posts: 9893
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby robcpettit » Thu Mar 13, 2008 1:18 pm

Thankyou for your reply. I tried object o = ba.getPrices(); It gives me the elements, but o[0]._____ doesnt let me in. Ive trie putting it in arraylist then using object, still no joy. Ill keep reading.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby GaryRussell » Thu Mar 13, 2008 3:07 pm

But don't you need to put object o[] = ba.getPrices() to define o as an array?
User avatar
GaryRussell
Site Admin
 
Posts: 9893
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby robcpettit » Thu Mar 13, 2008 4:44 pm

When I tried that, it gives me a compile error, without, it apears to be an array.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby robcpettit » Thu Mar 13, 2008 11:37 pm

Well Ive tried various combinations now. If I put a break in my code, I can see the details in myarray, just cant get them out. Try again tommorow.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby robcpettit » Fri Mar 14, 2008 9:26 pm

Hi, I cracked it. I still couldnt get to the data with prices[0].---, but I dont think Im supposed anyway. As in your help section it says getPrices(): Price()
Description
Returns last refreshed prices for all selections in currently displayed market in an array of Price object. Id forgot about the price object and was thinking to much about getprices. Anyway this is what I have done, If anyones using a more efficient method please let me know.
I created an array list the added the getprices, the looed through the array for the Price object.
private ArrayList prices = new ArrayList();
prices.AddRange(ba.getPrices()); (addrange instead off add, Add puts everthing into one element)
foreach (BettingAssistantCom.Application.Price data in prices)
{
double x = data.backMoney3;
}
Turned out to be easy in the end. As you can tell Im new to programming.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby GaryRussell » Sun Mar 16, 2008 9:35 am

I have created a working example in C#, download it from the following link. You will need to change the reference to the dll as it references my development dll. The example demonstrates fetching the first horse race, hooking up the pricesUpdated event and reading the prices.

http://www.gruss-software.co.uk/BA_COM_Test_C.zip
User avatar
GaryRussell
Site Admin
 
Posts: 9893
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby robcpettit » Mon Mar 17, 2008 11:24 am

Thankyou for the link. Makes thing alot clearer. Much appreciated.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby laffo16 » Tue Aug 12, 2008 3:38 am

just thought i'd post my findings in here, ive been a world of pain today trying to understand how to make this call in the autoit language. i new it had to be something simple but just couldnt figure it out. One of the things which baffled me is why some people are calling

Local $BAcom = ObjCreate("BettingAssistantCom.Application.Price")
and i noticed with me Obj browser that their are 4 or 5 other Objects which can be called. but i stook with ComClass in the end as i had already had some success with it.

i problem which i eventualy came to understanding was that $BAcom.getPrices() wasnt returning any data after ObjCreate. A delay of sorts was required until getPrices() returns some data. So i looped the call
Code: Select all
Local $BAcom = ObjCreate("BettingAssistantCom.Application.ComClass")

While 1
   $prices = $BAcom.getPrices()
   If UBound($prices) > 1 Then
      ExitLoop
   EndIf
WEnd

For $Element In $prices
   MsgBox(0, "", $Element.Selection)
Next
User avatar
laffo16
 
Posts: 172
Joined: Sun Jan 27, 2008 6:52 pm


Return to Discussion

Who is online

Users browsing this forum: No registered users and 29 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.