none
Convert VB6 to VB.NET RRS feed

  • Question

  • I have a program that already written in VB6, now I need to change it to VB.NET, but I got `System.AccessViolationException` error. 

    VB6

    Public result(512) As Byte
    Private Declare Function getInfo Lib "abc" Alias "_GetInfo@12" (ByVal uiCom As Long, ByVal uiParam As Long, ucResult As Any) As Long
    Dim isSuccess As Long
    isSuccess = getInfo(0, 1, result(0))

    VB.NET

    Public result(512) As Byte
    Private Declare Function getInfo Lib "abc" Alias "_GetInfo@12" (ByVal uiCom As Long, ByVal uiParam As Long, ByRef ucResult As Object) As Long
    Dim isSuccess As Long
    isSuccess = getInfo(0, 1, result)

    Is it because the result is passing the value not the reference to function?
    • Edited by Doris Pang Friday, October 13, 2017 3:19 AM
    Friday, October 13, 2017 3:18 AM

All replies