Results 1 to 5 of 5

Thread: Converting from VB6 to VB.net 3.5

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    35

    Converting from VB6 to VB.net 3.5

    I am converting my project from VB6 to VB.net 3.5 and
    at one place i have declared private variable a() as variant
    and i am using some place as b =a(index,0)
    it will work in VB but gives me error in VB.Net
    the error is Number of Indices exceeds the number of dimensions of the indexed array.

    Please help me

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Converting from VB6 to VB.net 3.5

    Can we see the code block? What is "index" declared as?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    35

    Re: Converting from VB6 to VB.net 3.5

    yes here is the code in vb
    Private a() As Variant

    Public Property Get JobA() As Variant()
    JobA = a
    End Property

    Public Property Get JobB(Index) As String
    JobB = a(Index, 0)
    End Property

    Index is integer and get from other form

    in VB.Net
    Public ReadOnly Property JobB(ByVal Index) As String
    Get
    JobB = a(Index, 0)
    End Get
    End Property

    i declare a in vb.net as Private a() As Object
    it will give me error at a(index,0)

  4. #4
    Addicted Member
    Join Date
    Nov 2006
    Location
    Minnesota
    Posts
    235

    Re: Converting from VB6 to VB.net 3.5

    Your line b = a(index, 0) is saying that a is mulitdimesional array where as the definition a() as variant states that it has a single dimension. You may just need to change the definition of the a array to something like Dim a(,) As Object, but as weirddemon says we could use a little code to help you better ...
    If someone has helped you, please make sure to rate them.

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    35

    Re: Converting from VB6 to VB.net 3.5

    demausdauth...
    i Tried Dim a(,) as object but it will gives me error in other function as i'm using a as single and two dimensional array

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