none
Difference between vb arraylist and c# arraylist RRS feed

  • Question

  • Is there a difference  between the arraylist in visual basic and arraylist in C#? 

    I had to convert some C# code to VB and there is a call I make in a third party api that requires me to pass in an arraylist.  When I do this in C# it works just fine, but when I do this in VB, I just get back a vaque exception from the api.  Any ideas?

    • Moved by Bob_BaoModerator Thursday, April 12, 2012 4:02 AM (From:Visual Studio Tools for Office)
    Wednesday, April 11, 2012 3:16 PM

All replies

  • Hi Beto363,

    Thanks for posting in the MSDN Forum.

    This is a specialty forum for Visual Studio Tools for Office issue. I would recommend you post your in C# forum or VB.NET forum for better support.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 12, 2012 2:23 AM
  • What is the exception, and what is your code in C# and the converted VB.Net code? Could you please share here? Otherwise, it likes a puzzle. Thanks.

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 12, 2012 4:01 AM
    Moderator
  • There is not any difference the arraylist is a part of .Net, not from C# or VB. It is still the same since Framework beta 0.n

    As this question requires code which you can show (you probably do something wrong) is this more a VB then a C# question.

    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral

    There is likely somebody in that forum who can answer your problem in 5 minutes in that forum if you show your code.


    Success
    Cor

    Thursday, April 12, 2012 7:13 AM
  • My code is extremely simple. 

    Dim thirdPartyApi As New ThirdPartyApi()
    Dim arrListEntryId As New ArrayList()
     arrListEntryId.Add("string1")
     arrListEntryId.Add("string2")
     arrListEntryId.Add("string3")
     arrListEntryId.Add("string4")
    thirdPartyApi.ApiCall(arrListEntryId)

    This exact same code works just fine in C#.  The only thing i could think of is that there is some non apparent difference in the ArrayList object in vb from C#.
    Thursday, April 12, 2012 3:23 PM
  • It's the same class, it's just being called from a different language.
    Thursday, April 12, 2012 3:33 PM
  • The code converted to VB.Net should work, so I think the problem is caused in the ThirdPartyApi.ApiCall method, could you please tell us the exception you get and what is this ApiCall method code?

    Please add Try ... Catch .. to check if there is one exception in your code.


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, April 13, 2012 7:44 AM
    Moderator