Question Making a call to Dll

Pinto

Member
Joined
May 19, 2013
Messages
15
Programming Experience
5-10
I have an app that worked just fine in VB6.I have ported all over to VB.net. What I am having troubles with is making a call into a dll upon start up. When I make the call I get the following error:Attempted to "read or write protected memory. This is often an indication that other memory is corrupt.". If I take the exact same code and create a button to fire off the code it works ok. SO how can I make the call to the dll upon startup? If the code works behind a button why won't it work in the Sub Main?
 
We'd have to know more than just the error message. We'd have to know what you're calling and how. Show us the original VB6 code that made the call and the new VB.NET code and also the library function that you're calling.
 
We'd have to know more than just the error message. We'd have to know what you're calling and how. Show us the original VB6 code that made the call and the new VB.NET code and also the library function that you're calling.

Well I figure out that if I use DLLImport as opposed to just declareing the dll it works just fine. The dll must be trying to use some of the same memory as vb when loading. Anyway I will use the dllImport method.

Thank you for responding
 
Back
Top