Error 13 Mismatch

Discussion in 'Code Snippets and Tutorials' started by Snowman, Apr 16, 2007.

  1. Snowman

    Snowman Level IV

    Joined:
    Apr 9, 2007
    Messages:
    825
    Likes Received:
    0
    Well I'm trying to make a Neopets Autopricer and i get this error when I do the following:

    I'm trying to the average price of an item by getting three different prices from the SW and getting the average. When I get one i try to set it to the array av(1) by using this code.

    av(1) = avgprice.Text

    And I get the error.
    If you're wondering why im using a textbox and not a variable it's because i get the same error in other occasions when using a variable and not a textbox.

    Any ideas?
     
  2. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    Probably the array av() is not a String... so it can't store a sting in a numeric variable... That's why sometimes textboxes work for you.
    I hope this helped ;)
     
  3. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    Well, you see I was making one just have a few more bugs to fix. There should be a sticky here of programs you are making. And to let you know list boxes start at 0 for id of numbers. I have had a problem with that also.
     
  4. Snowman

    Snowman Level IV

    Joined:
    Apr 9, 2007
    Messages:
    825
    Likes Received:
    0
    I defined the array as a integer and I have tried a long. I'n not sure if defining it as a string will work but ill try. Oh and yes I knew listboxes started at 0.
     
  5. bigjohn

    bigjohn Level II

    Joined:
    Apr 1, 2007
    Messages:
    251
    Likes Received:
    0
    Location:
    Wales
    Im new to vb , but shouldn.t you cast avgprice.Text to an integer if the array is defined as integer
     
  6. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    Another suggestion: try
    Code (Text):
    1. av(1) = [b]Val([/b]avgprice.text[b])[/b]
     
  7. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    ok if you have already got the average price then use a string. You'll be posting strings maybe that will help
     
  8. Snowman

    Snowman Level IV

    Joined:
    Apr 9, 2007
    Messages:
    825
    Likes Received:
    0
    ok ill try that, thanks for your help. Hopefully ill get this program doen soon.
     
  9. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    and also you can only have str = lstsomething.list(x) + "hi" + lstother.list(y)
    you cannot have str = lngcost + lstsomething(x) + "hi"
    That caused my error 13.