If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Try to see if the company that designed AxBarcodeCG.dll has a .NET version of that dll.

The way you are trying to call it, it looks like an old C or C++ dll, and those are hard to get to from .NET. Most of the code published for those has been written in VB6 and does not translates directly to .NET. dll were mostly replaced by COM dlls during the 90's, and those are now being replaced by .NET dlls. Too bad Microsoft decided to keep the same extension. Although they have the same function, the 3 types of dll are different beasts and do not have the same calling conventions. What you are trying to do is to use a 2010 technology to call a dll that was buits on a technology of the 80's, that is quite a step, that usually can be gapped, not always.

It does not seem at first sight to be an issue with your own thing, but for instance, the AsAny keyword in VB6 does not work in VB.NET where you need to work with overloading

Unfortunately, I won't be able to help you more than this, having had very little experience with that stuff in .NET.

Hope somebody else will be able to help you with your current code if you cannot do otherwise.

Ooops did not look carefully enough, and since you use old conventions, I was mistaken.

We have stopped using all uppercases constants around the time VB4 came on the market, in the middle of the 90's. Usually, when you see those in modern code, it is to call old code.

The Declare statement, as I might have mentioned before, is used to link with old C/C++ dlls or to call Windows internal functions (which are for the most part written that way to enable old applications to still work in the newer versions of Windows). It has never been used to communicate with a dll written in VB.

What I was was looking like old code I haven't seen for a while.

Sorry.

-----

Although your constants will work as they are, the conventions that have become common in recent years would rather give something like

Public Const DllProcessDetach = 0

The uppercase with underscore convention dates from the time when code had to be written all in uppercase... wich has gone away in Windows. People who program in C tend to stick to those old conventions out of habit. Same goes for field names in databases.

-----

As for the connection to the dll, Decalre does not work because when you use that, the system tries to connect to your VB dll as if it was an old C++ dll. That will never work.

To use a modern dll, go into the Project menu and activate Add Reference. Your dll will probably not appear in the list of available dlls shown there, but you can go into the Browse tab, point to your dll and click OK. Once a dll has been referenced that way, you can use call it from anywhere in the project.

If you want to see the dlls that are actually referenced in your project (and maybe make sure that your's has been added to the list), open the Project properties, last option in the Project tab. In the References tab, you will see all the dlls actually available for your code.

If you ever try to use one of the framework classes and you get an error message to the effect that it is not recogized, it is probably because you did not add the dll that contains that class to the references. The documentation for all classes / properties / methods / events usually tells you, somewhere at the top of each page, the name of the dll you need in order to use that class.

Note that because you declare the paramater to pass to do_barcode as a String, you need to pass "1", between double quotes, instead of simply 1. 1 alone might work, depending on compiler settings set in the project properties, but this requires a conversion from Integer (1 is an Integer) to a String ("1" is a String), which is not as efficient and might sometimes lead to errors.

Hope this works, I do not have time to copy and test your class in my development environment to make sure that I did not miss anything.