
I get this error when I'm executing my program:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
Code:
Sub ShowMprices(ByVal MpriceResp As BFUK.GetMarketPricesResp)
Dim aPriceB(2) As String
Dim bPriceB(2) As String
Dim aPriceL(2) As String
Dim bPriceL(2) As String
With MpriceResp
CheckHeader(.header)
Print("ErrorCode = " & .errorCode.ToString)
If .errorCode = BFUK.GetMarketPricesErrorEnum.OK Then
With .marketPrices
Dim MS As String
MS = Val(bMstatus.Text)
MS = .marketStatus
Dim MID As String
MID = Val(bMarkid.Text)
MID = .marketId
With .runnerPrices(0)
Dim Id0 As String
Id0 = Val(bSelecid.Text)
Id0 = .selectionId
With .bestPricesToBack(0)
aPriceB(0) = .price
aB0.Text = aPriceB(0)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
aBA0.Text = y
End With
With .bestPricesToLay(0)
aPriceL(0) = .price
aL0.Text = aPriceL(0)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
aLA0.Text = y
End With
With .bestPricesToBack(1)
aPriceB(1) = .price
aB1.Text = aPriceB(1)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
aBA1.Text = y
End With
With .bestPricesToLay(1)
aPriceL(1) = .price
aL1.Text = aPriceL(1)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
aLA1.Text = y
End With
With .bestPricesToBack(2)
aPriceB(2) = .price
aB2.Text = aPriceB(2)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
aBA2.Text = y
End With
With .bestPricesToLay(2)
aPriceL(2) = .price
aL2.Text = aPriceL(2)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
aLA2.Text = y
End With
End With
With .runnerPrices(1)
bSelectid1.Text = .selectionId
With .bestPricesToBack(0)
bPriceB(0) = .price
bB0.Text = bPriceB(0)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
TextBox3.Text = y
End With
With .bestPricesToLay(0)
bPriceL(0) = .price
bL0.Text = bPriceL(0)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
TextBox1.Text = y
End With
With .bestPricesToBack(1)
bPriceB(1) = .price
TextBox43.Text = bPriceB(1)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
TextBox42.Text = y
End With
With .bestPricesToLay(1)
bPriceL(1) = .price
TextBox35.Text = bPriceL(1)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
TextBox33.Text = y
End With
With .bestPricesToBack(2)
bPriceB(2) = .price
TextBox41.Text = bPriceB(2)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
TextBox40.Text = y
End With
With .bestPricesToLay(2)
bPriceL(2) = .price
TextBox34.Text = bPriceL(2)
Dim y As Integer
Dim x As Double = .amountAvailable
y = Convert.ToInt32(x)
TextBox32.Text = y
End With
End With
End With
Else
Print("ShowMprices Error")
End If
End With
End Sub
I have no idea how to solve his and believe me I've googled a lot

Thanks in advance.




Leave a comment: