Results 1 to 3 of 3

Thread: Trying to pass 2D Array to Function...

  1. #1

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Trying to pass 2D Array to Function...

    VB Code:
    1. If INIT_ROW_ZERO(init_Eqs, MyI) = False Then

    If you get the Squiggly under an array, like I did a few minutes ago with init_Eqs in the code above, and hover over it, if you see:
    Value of type '2-dimensional array of System.object' cannot be converted to '2-dimensional array of integer' because 'System.object' is not derived from 'Integer'
    it might mean you did something like:

    VB Code:
    1. Public init_Eqs(0, 0)


    When you really meant to do something like this:

    VB Code:
    1. Public init_Eqs(0, 0) As Integer

    I had about 15 Publicly declared items, Arrays mostly, and it turned out that init_Eqs was the only one not assigned a type!
    Spent about 10 minutes on that one.



  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    I think the problem lies with your function declaration.

    The array your are trying to pass is apparantly an object.

    but you function is expecting an integer.

    Try changing you function declaration to accept objects instead of integers.

    That should do it.

    Happy Newyear.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Thanks!
    I wasn't expecting an Answer, but thanks anyways.

    It was that I hadn't assigned a type to my variable, but since I was sure I had, I spent that 10 minutes banging my head on a wall before I realized I had better double check.

    I actually realized it as I started to post this thread, so I decided to just post the solution itself, with the observation on what it looks like when you get the error.

    -Lou

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width