Using VB2008 to acccess the Betfair API: A tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Camper
    Junior Member
    • Jul 2011
    • 30

    #691
    Thank you! I'm not at my computer now but I will try it later.

    Another thing, I have no idea how to write a code to close a trade using VB, I have to do other things in my program before i start thinking about that but everytime I do I get scared

    I'm reading this topic when I have some free time, I'm currently on page 40 or so, I don't know if that subject will come on the next twenty pages.

    Comment

    • BigSprout
      Junior Member
      • Feb 2011
      • 60

      #692
      Camper,
      the topics pertaining to bet placement are covered in page 19 -> 24

      Step 19. Place a Bet
      Step 21. Cancel a Bet
      Step 22. Change Bet size & price
      Step 23. Changing a Bet
      Step 20. Monitor a Bet

      There is an index of all the steps on page 45, supplied by member "labus", which I have bookmarked

      cheers

      Comment

      • Camper
        Junior Member
        • Jul 2011
        • 30

        #693
        Thanks for the info, I've already read those a few days ago and used some of the info on my program.

        But let's say I have a back on player one and a lay on player 2, what I need to do to trade out those 2 bets? With multiple positions open on a market I don't know what to do, with one bet only it's quite easy I think.

        I will read those posts you said again, maybe I'm missing something.

        Regards

        Comment

        • pubnuts
          Junior Member
          • Aug 2011
          • 1

          #694
          Step 2

          Hi all,

          I am trying to implement step 2 using vb 2010 but I am getting the following error on the BLogin_Click sub.

          Value of type 'BetfairBot.BFGlobal.KeepAliveReq' cannot be converted to 'BetfairBot.BFGlobal.keepAliveIn'

          This error occurs on the following line of code

          oLoginResp = BetfairGL.login(oLoginReq) 'Call the API

          I am getting a similar error on the bKeepAlive_Click sub.

          I don't see anyone else coming across the same error so I must have something wrong.

          I would appreciate it if anyone can help

          Thanks.

          Comment

          • Camper
            Junior Member
            • Jul 2011
            • 30

            #695
            Hi again

            I get this error when I'm executing my program:
            System.IndexOutOfRangeException: Index was outside the bounds of the array.
            ...on this code:
            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 googled and it seems that I'm getting this error because I'm using an index here that is higher than the number of items in the array.

            I have no idea how to solve his and believe me I've googled a lot

            Thanks in advance.

            Comment

            • BigSprout
              Junior Member
              • Feb 2011
              • 60

              #696
              Hi Camper,
              Normally the "Index out of range" error is caused by requesting data which isn't there,

              e.g
              there is only 1 price in Best Prices so:

              Code:
              	.bestPricesToBack(0).price 'would give a valid return
              	.bestPricesToBack(1).price 'would give an "Index out of range" error
              so you need to test first with something like:

              Code:
              if .bestPricesToBack.length>0 then
                  with .bestPricesToBack(0)
              
                  ...your code
              
                  end with
              end if
              
              if .bestPricesToBack.length>1 then
                  with .bestPricesToBack(1)
              
                  ...your code
              
                  end with
              end if
              
              ...etc

              What you have written is okay and working well for you, so these are just a few suggestions that may help in shortening the amount of code

              Code:
              '*** You can also decrease the amount of code written
              	bPriceB(2) = .price
              	TextBox41.Text = bPriceB(2)
              
              '*** can be written in one line as:
              	TextBox41.Text = format(.price,"0.00")
              
              
              
              	Dim y As Integer
              	Dim x As Double = .amountAvailable
              	y = Convert.ToInt32(x)
              	TextBox40.Text = y
              
              '*** can be written in one line as:
              	TextBox40.Text = format(.amountAvailable,"0.00")
              
              '*** or if you want it as an integer value:
              	TextBox40.Text = format(.amountAvailable,"0")
              Last edited by BigSprout; 10-08-2011, 01:40 AM.

              Comment

              • Camper
                Junior Member
                • Jul 2011
                • 30

                #697
                Thanks for your help

                I did as you said but a strange thing is happening.

                The code I'm using now is this:
                Code:
                   Sub ShowMprices(ByVal MpriceResp As BFUK.GetMarketPricesResp)
                        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
                                        If .bestPricesToBack.Length > 0 Then
                                            With .bestPricesToBack(0)
                                                aB0.Text = Format(.price, "0.00")
                                                aBA0.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToLay.Length > 0 Then
                                            With .bestPricesToLay(0)
                                                aL0.Text = Format(.price, "0.00")
                                                aLA0.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToBack.Length > 1 Then
                                            With .bestPricesToBack(1)
                                                aB1.Text = Format(.price, "0.00")
                                                aBA1.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToLay.Length > 1 Then
                                            With .bestPricesToLay(1)
                                                aL1.Text = Format(.price, "0.00")
                                                aLA1.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToBack.Length > 2 Then
                                            With .bestPricesToBack(2)
                                                aB2.Text = Format(.price, "0.00")
                                                aBA2.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToLay.Length > 2 Then
                                            With .bestPricesToLay(2)
                                                aL2.Text = Format(.price, "0.00")
                                                aLA2.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                    End With
                                    With .runnerPrices(1)
                                        Dim Id1 As String
                                        Id1 = Val(bSelectid1.Text)
                                        Id1 = .selectionId
                                        If .bestPricesToBack.Length > 0 Then
                                            With .bestPricesToBack(0)
                                                bB0.Text = Format(.price, "0.00")
                                                TextBox3.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToLay.Length > 0 Then
                                            With .bestPricesToLay(0)
                                                bL0.Text = Format(.price, "0.00")
                                                TextBox1.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToBack.Length > 1 Then
                                            With .bestPricesToBack(1)
                                                TextBox43.Text = Format(.price, "0.00")
                                                TextBox42.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToLay.Length > 1 Then
                                            With .bestPricesToLay(1)
                                                TextBox35.Text = Format(.price, "0.00")
                                                TextBox33.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToBack.Length > 2 Then
                                            With .bestPricesToBack(2)
                                                TextBox41.Text = Format(.price, "0.00")
                                                TextBox40.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                        If .bestPricesToLay.Length > 2 Then
                                            With .bestPricesToLay(2)
                                                TextBox34.Text = Format(.price, "0.00")
                                                TextBox32.Text = Format(.amountAvailable, "0")
                                            End With
                                        End If
                                    End With
                                End With
                            Else
                                Print("ShowMprices Error")
                End If
                        End With
                    End Sub
                I'm getting wrong values everywhere, sometimes the prices are working great, sometimes other values are shown (5th best price or greater) and other times no value at all.
                Last edited by Camper; 10-08-2011, 04:51 AM.

                Comment

                • BigSprout
                  Junior Member
                  • Feb 2011
                  • 60

                  #698
                  Camper,
                  this could be because you aren't clearing your text boxes, e.g:

                  TextBox34.text displays "3.45" when you 1st read in price data, then the next time there is no data for .bestPricesToLay(2) and so TextBox34.text still displays "3.45" (remains the same) and seems to be reading incorrect data.

                  You need to clear the displays if no data is available:

                  Code:
                  If .bestPricesToLay.Length > 2 Then
                      With .bestPricesToLay(2)
                  	TextBox34.Text = Format(.price, "0.00")
                  	TextBox32.Text = Format(.amountAvailable, "0")
                      end with
                  [COLOR="Red"]else 
                      TextBox34.text=""
                      TextBox32.Text=""[/COLOR]
                  end if

                  Comment

                  • Camper
                    Junior Member
                    • Jul 2011
                    • 30

                    #699
                    Still with the same errors.

                    The code I'm using:
                    Code:
                    Sub showmprices(ByVal mpriceresp As BFUK.GetMarketPricesResp)
                            Dim id0, ms, mid, id1 As String
                            ms = Val(bMstatus.Text)
                            mid = Val(bMarkid.Text)
                            id0 = Val(bSelecid.Text)
                            id1 = Val(bSelectid1.Text)
                            With mpriceresp
                                CheckHeader(.header)
                                Print("errorcode = " & .errorCode.ToString)
                                If .errorCode = BFUK.GetMarketPricesErrorEnum.OK Then
                                    With .marketPrices
                                        ms = .marketStatus
                                        mid = .marketId
                                        For i = 0 To .runnerPrices.Length - 1
                                            With .runnerPrices(i)
                                                If .selectionId = id0 Then
                                                    If .bestPricesToBack.Length > 0 Then
                                                        With .bestPricesToBack(0)
                                                            aB0.Text = Format(.price, "0.00")
                                                            aBA0.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        aB0.Text = ""
                                                        aBA0.Text = ""
                                                    End If
                                                    If .bestPricesToLay.Length > 0 Then
                                                        With .bestPricesToLay(0)
                                                            aL0.Text = Format(.price, "0.00")
                                                            aLA0.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        aL0.Text = ""
                                                        aLA0.Text = ""
                                                    End If
                                                    If .bestPricesToBack.Length > 1 Then
                                                        With .bestPricesToBack(1)
                                                            aB1.Text = Format(.price, "0.00")
                                                            aBA1.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        aB1.Text = ""
                                                        aBA1.Text = ""
                                                    End If
                                                    If .bestPricesToLay.Length > 1 Then
                                                        With .bestPricesToLay(1)
                                                            aL1.Text = Format(.price, "0.00")
                                                            aLA1.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        aL1.Text = ""
                                                        aLA1.Text = ""
                                                    End If
                                                    If .bestPricesToBack.Length > 2 Then
                                                        With .bestPricesToBack(2)
                                                            aB2.Text = Format(.price, "0.00")
                                                            aBA2.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        aB2.Text = ""
                                                        aBA2.Text = ""
                                                    End If
                                                    If .bestPricesToLay.Length > 2 Then
                                                        With .bestPricesToLay(2)
                                                            aL2.Text = Format(.price, "0.00")
                                                            aLA2.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        aL2.Text = ""
                                                        aLA2.Text = ""
                                                    End If
                                                End If
                                                If .selectionId = id1 Then
                                                    If .bestPricesToBack.Length > 0 Then
                                                        With .bestPricesToBack(0)
                                                            bB0.Text = Format(.price, "0.00")
                                                            TextBox3.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        bB0.Text = ""
                                                        TextBox3.Text = ""
                                                    End If
                                                    If .bestPricesToLay.Length > 0 Then
                                                        With .bestPricesToLay(0)
                                                            bL0.Text = Format(.price, "0.00")
                                                            TextBox1.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        bL0.Text = ""
                                                        TextBox1.Text = ""
                                                    End If
                                                    If .bestPricesToBack.Length > 1 Then
                                                        With .bestPricesToBack(1)
                                                            TextBox43.Text = Format(.price, "0.00")
                                                            TextBox42.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        TextBox43.Text = ""
                                                        TextBox42.Text = ""
                                                    End If
                                                    If .bestPricesToLay.Length > 1 Then
                                                        With .bestPricesToLay(1)
                                                            TextBox35.Text = Format(.price, "0.00")
                                                            TextBox33.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        TextBox35.Text = ""
                                                        TextBox33.Text = ""
                                                    End If
                                                    If .bestPricesToBack.Length > 2 Then
                                                        With .bestPricesToBack(2)
                                                            TextBox41.Text = Format(.price, "0.00")
                                                            TextBox40.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        TextBox41.Text = ""
                                                        TextBox40.Text = ""
                                                    End If
                                                    If .bestPricesToLay.Length > 2 Then
                                                        With .bestPricesToLay(2)
                                                            TextBox34.Text = Format(.price, "0.00")
                                                            TextBox32.Text = Format(.amountAvailable, "0")
                                                        End With
                                                    Else
                                                        TextBox34.Text = ""
                                                        TextBox33.Text = ""
                                                    End If
                                                End If
                                            End With
                                        Next
                                    End With
                                End If
                            End With
                        End Sub
                    Output:


                    The real values on Betfair:


                    This is driving me nuts.

                    I thought it may be better to use getMarketPricesCompressed because it returns the best 3 available back prices and the best 3 available lay prices with amounts available, exactly what I need. I'll try and let you know.
                    Last edited by Camper; 11-08-2011, 01:38 AM.

                    Comment

                    • BigSprout
                      Junior Member
                      • Feb 2011
                      • 60

                      #700
                      Camper,
                      this type of error causes the problems you are getting (clearing the wrong text box):

                      Code:
                                                      If .bestPricesToLay.Length > 2 Then
                                                          With .bestPricesToLay(2)
                                                              TextBox34.Text = Format(.price, "0.00")
                                                              [COLOR="Red"]TextBox32.Text[/COLOR] = Format(.amountAvailable, "0")
                                                          End With
                                                      Else
                                                          TextBox34.Text = ""
                                                          [COLOR="Red"]TextBox33.Text[/COLOR] = ""
                                                      End If
                      I think it would be in your best interest to get some books on programming in VB2010 and also check if there is any suitable courses being run at any of your local schools/colleges/universities that you can attend.

                      The errors you are making will most probably be very costly if they continue into placing bets code

                      Comment

                      • Camper
                        Junior Member
                        • Jul 2011
                        • 30

                        #701
                        Thanks BigSprout.

                        I ended up using getMarketPricesCompressed and the code on step14.

                        If someone wants to know how to do a small ladder using textbox's to display the 3 best back and lay prices this is the part of the Mumble0's code I changed:

                        Code:
                            Private Sub BetFairUK_getMarketPricesCompressedCompleted(ByVal sender As Object, ByVal e As BFUK.getMarketPricesCompressedCompletedEventArgs) Handles BetFairUK.getMarketPricesCompressedCompleted
                                Dim id0, id1 As String
                                id0 = Val(bSelecid.Text)
                                id1 = Val(bSelectid1.Text)
                                Try
                                    If Not e.Cancelled Then
                                        With e.Result
                                            CheckHeader(.header)
                                            Print("ErrorCode = " & .errorCode.ToString)
                                            If .errorCode = BFUK.GetMarketPricesErrorEnum.OK Then
                                                Dim oMarketPrices As New UnpackMarketPricesCompressed(.marketPrices)
                                                With oMarketPrices
                                                    For i = 0 To .runnerPrices.Length - 1
                                                        With .runnerPrices(i)
                                                            If .selectionId = id0 Then
                                                                If .bestPricesToBack.Length > 0 Then
                                                                    aB0.Text = .bestPricesToBack(0).price
                                                                    aBA0.Text = Int(.bestPricesToBack(0).amountAvailable)
                                                                End If
                                                                If .bestPricesToBack.Length > 1 Then
                                                                    aB1.Text = .bestPricesToBack(1).price
                                                                    aBA1.Text = Int(.bestPricesToBack(1).amountAvailable)
                                                                End If
                                                                If .bestPricesToBack.Length > 2 Then
                                                                    aB2.Text = .bestPricesToBack(2).price
                                                                    aBA2.Text = Int(.bestPricesToBack(2).amountAvailable)
                                                                End If
                                                                If .bestPricesToLay.Length > 0 Then
                                                                    aL0.Text = .bestPricesToLay(0).price
                                                                    aLA0.Text = Int(.bestPricesToLay(0).amountAvailable)
                                                                End If
                                                                If .bestPricesToLay.Length > 1 Then
                                                                    aL1.Text = .bestPricesToLay(1).price
                                                                    aLA1.Text = Int(.bestPricesToLay(1).amountAvailable)
                                                                End If
                                                                If .bestPricesToLay.Length > 2 Then
                                                                    aL2.Text = .bestPricesToLay(2).price
                                                                    aLA2.Text = Int(.bestPricesToLay(2).amountAvailable)
                                                                End If
                                                            End If
                                                            If .selectionId = id1 Then
                                                                If .bestPricesToBack.Length > 0 Then
                                                                    bB0.Text = .bestPricesToBack(0).price
                                                                    bBA0.Text = Int(.bestPricesToBack(0).amountAvailable)
                                                                End If
                                                                If .bestPricesToBack.Length > 1 Then
                                                                    bB1.Text = .bestPricesToBack(1).price
                                                                    bBA1.Text = Int(.bestPricesToBack(1).amountAvailable)
                                                                End If
                                                                If .bestPricesToBack.Length > 2 Then
                                                                    bB2.Text = .bestPricesToBack(2).price
                                                                    bBA2.Text = Int(.bestPricesToBack(2).amountAvailable)
                                                                End If
                                                                If .bestPricesToLay.Length > 0 Then
                                                                    bL0.Text = .bestPricesToLay(0).price
                                                                    bLA0.Text = Int(.bestPricesToLay(0).amountAvailable)
                                                                End If
                                                                If .bestPricesToLay.Length > 1 Then
                                                                    bL1.Text = .bestPricesToLay(1).price
                                                                    bLA1.Text = Int(.bestPricesToLay(1).amountAvailable)
                                                                End If
                                                                If .bestPricesToLay.Length > 2 Then
                                                                    bL2.Text = .bestPricesToLay(2).price
                                                                    bLA2.Text = Int(.bestPricesToLay(2).amountAvailable)
                                                                End If
                                                            End If
                                                        End With
                                                    Next
                                                End With
                                            End If
                                        End With
                                    End If
                                Catch ex As ApplicationException
                                    Print(e.Error.Message)
                                End Try
                            End Sub
                        It's working just fine

                        Comment

                        • Geierkind
                          Junior Member
                          • May 2011
                          • 10

                          #702
                          Hi

                          I got a small problem here:

                          I will present a sub for showing Prices of AllMarkets (usual stuff). But in it I will filter Cleansheet markets. This is no problem for 3way bets since the condition string will just be "MatchOdds" or in german language "Wettquoten". But for Cleansheet-Markets betfair doesnt provide all markets in one language but mixes the Strings. So far.
                          Now it gets a bit worse for my very little experience with VB, because I dont really know how to write placeholders in the string. And since the market-names for Cleansheet-Bets contain(!) the name of any team, I would like to use them. Thanks for any help. This would be my sub, and my idea for the solution, which just doesn't find any markets in AllMarkets which fit the condition. Thanks for any help!
                          Code:
                           Private Sub clsprices_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clsprices.Click
                                  tLog.Text = ""
                                  With AllMarkets
                                      For j = 0 To AllMarkets.marketData.Length - 1
                                          If AllMarkets.marketData(j).marketName = "*Clean Sheet*" Or AllMarkets.marketData(j).marketName = "*ohne Gegentor*" Then
                                              iMarket = j
                                             
                                              ShowMprices(BetFairUK.getMarketPrices(MpricesReq))    'Get market prices
                          
                                          End If
                          
                             
                                  End With
                              End Sub
                          Last edited by Geierkind; 14-08-2011, 11:35 PM.

                          Comment

                          • Mumbles0
                            Junior Member
                            • Jan 2009
                            • 240

                            #703
                            Geierkind,

                            The " placeholder" characters (*, #, etc.) have no special meaning within a VB string. Probably easiest to use the String.Contains method, for example:

                            If .marketName.Contains("Clean Sheet") Then

                            You could also use the InStr function.
                            Note that the substring comparison is case-sensitive.

                            Comment

                            • Geierkind
                              Junior Member
                              • May 2011
                              • 10

                              #704
                              Hey, now thats first-hand help

                              Thank you very much

                              PS: Your Tutorial is just great! I didn't know anything about VB and now just after reading and trying to understand whats going on in your tutorial I get all things done, even by myself so far
                              I would certainly donate a few dollars if you had asked. A good guy you are!

                              Comment

                              • I am the one and only223
                                Junior Member
                                • Sep 2009
                                • 7

                                #705
                                Excellent thread. Wish I'd found it a long time ago!

                                The app works fine in VS2010 but when I create a .exe file for the simplest version, it falls over when logging in. What's the best way to create a .exe file?

                                Thanks

                                Comment

                                Working...
                                X