use of any in vb.net
-
I am migrating the vb project from vb6.0 to vb.net framework.when i am trying to migrate the api function its showing the error in any the below function. Declare Function CopyString Lib "kernel32" Alias "lstrcpy" (hdest As Any, hsource As Any) As Long in this function vb.net dosent support any as keyword.give me some solution for solving the above problem.. pls reply me as soon as possible:((
-
I am migrating the vb project from vb6.0 to vb.net framework.when i am trying to migrate the api function its showing the error in any the below function. Declare Function CopyString Lib "kernel32" Alias "lstrcpy" (hdest As Any, hsource As Any) As Long in this function vb.net dosent support any as keyword.give me some solution for solving the above problem.. pls reply me as soon as possible:((
"As Any" was a bad idea in VB6 and there is no need whatsopever for it in VB.Net - instead declare an overloaded version of the function for each of the data types you are going to pass to the API.
'--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd
-
I am migrating the vb project from vb6.0 to vb.net framework.when i am trying to migrate the api function its showing the error in any the below function. Declare Function CopyString Lib "kernel32" Alias "lstrcpy" (hdest As Any, hsource As Any) As Long in this function vb.net dosent support any as keyword.give me some solution for solving the above problem.. pls reply me as soon as possible:((
On top of what Duncan posted, CopyString has some SERIOUS limitations on it's use in the .NET Framework. Since an object can be moved at any time, CopyString can be passed invalid addresses unless the objects invloved are pinned in place. What does this function do that you require the use of CopyString??
Dave Kreskowiak Microsoft MVP - Visual Basic