It look like you are still a bit confused by classes, objects, methods, etc. and passing arguments to procedures (i.e. subs and functions).
In step 7 Sub ShowMprices simply "prints" the properties of the GetMarketPricesResp object passed to it as a parameter. You have modified this sub by making it a function method of your BFInterface class which returns a string. That’s OK but, because the parameter remains the same, it should be called similar to the Step 7 example.
You have declared the function method like this:
Public Function ShowMprices(ByVal MpriceResp As BFUK.GetMarketPricesResp) As String
The argument used in the call must evaluate to an object of type BFUK.GetMarketPricesResp. You could call this as in Step 7:Dim sMsg As String = BFIF.ShowMprices(BetFairUK.getMarketPrices(Mprices Req))
where MpricesReq is the function which returns the request object given in Step 7.To make this clearer I will expand this out:
Code:
Dim PricesResp As BFUK.GetMarketPricesResp 'Declare a variable to hold an object of type BFUK.GetMarketPricesResp PricesResp = BetFairUK.getMarketPrices(MpricesReq) 'Call the API to get the response object Dim sMsg As String = BFIF.ShowMprices(PricesResp) 'Call ShowMprices with the response object as the argument
You have mentioned that you are trying to make a class (presumably BFInterface) containing the various API calls. This is a good idea, but using ShowMprices isn’t the way to go. Each method of the class should contain code to call the API. ShowMprices does not do this.


Leave a comment: