Using COM from VB/C#?

Please post any questions regarding the program here.

Moderator: 2020vision

Using COM from VB/C#?

Postby rangie » Tue Jul 19, 2011 12:52 am

Hi,

The BA software and these forums are excellent but i've now hit a problem.

I'm trying to use the COM interface from VB/C# (VS2010). I got a little VB test app running that responds to events from BA. Works fine _until_ i shut my app down and restart it to find that it no longer sees the events. Calls to eg getBalance() do still work though, so the link isn't broken entirely. If I then restart BA and then my app, everything works again until i restart my app a second time.

I've tried reinstalling BA and using the RegCleaner thing i found on this forum. No change. I also wrote a C# version of the app and it (mis)behaves in exactly the same way.

I assume i'm doing something wrong in either the event-handling or app shutdown. Any help would be much appreciated as it's driving me mad at the mo.

Here's a simple module that shows the problem (there's also a form with 2 buttons that just call the start/stop subs) - it just beeps every time an update event occurs:
------------------------------------------------------
Module Module1
Dim WithEvents ba As BettingAssistantCom.Application.ComClass

Public Sub ba_pricesUpdated() Handles ba.pricesUpdated
Beep()
End Sub

Public Sub start_looking()
If ba Is Nothing Then
ba = New BettingAssistantCom.Application.ComClass
End If
End Sub

Public Sub stop_looking()
ba = Nothing
End Sub
End Module
------------------------------------------------------

and another that sets up the event handling in a different way but behaves the same:

------------------------------------------------------
Module Module1
Dim WithEvents ba As BettingAssistantCom.Application.ComClass

Public Sub pricesUpdated()
Beep()
End Sub

Public Sub start_looking()
If ba Is Nothing Then
ba = New BettingAssistantCom.Application.ComClass

AddHandler ba.pricesUpdated, AddressOf pricesUpdated
End If
End Sub

Public Sub stop_looking()
RemoveHandler ba.pricesUpdated, AddressOf pricesUpdated

ba = Nothing
End Sub
End Module

------------------------------------------------------

what am i doing wrong/missing?
rangie
 
Posts: 2
Joined: Tue Jul 19, 2011 12:11 am

Postby GaryRussell » Tue Jul 19, 2011 6:11 am

This could be a problem in the way that BA fires the events. I will investigate and get back to you asap.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby GaryRussell » Tue Jul 19, 2011 8:36 am

Please uninstall and re-install from the link below and let me know if it works.

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

Postby rangie » Tue Jul 19, 2011 10:14 am

Yep, you nailed it :)

even tried both VB and C# apps at the same time, shutting just one down or both. seems to be running perfectly the whole time.

Thanks very much for sorting this - epic support.

baz.
rangie
 
Posts: 2
Joined: Tue Jul 19, 2011 12:11 am


Return to Help

Who is online

Users browsing this forum: Bing [Bot] and 45 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.