Name 'VB6' is not declared

N

Nikolay Petrov

I have some old VB6 projects, which when converted to VB .NET gave me the
"Name 'VB6' is not declared" error.
Example:
VB6.CopyArray(arrSessionInfo)

what is that VB6? how should I declare it?
 
A

Armin Zingler

Nikolay Petrov said:
I have some old VB6 projects, which when converted to VB .NET gave me
the "Name 'VB6' is not declared" error.
Example:
VB6.CopyArray(arrSessionInfo)

what is that VB6? how should I declare it?

Did you change anything after the upgrade wizard did his job?

Usually, there should be a reference to
Microsoft.VisualBasic.Compatibility.dll, and the namespace
Microsoft.VisualBasic.Compatibility is imported at project level (see
project properties). As there is also the namespace
Microsoft.VisualBasic.Compatibility.VB6, one should be able to write

VB6.<anything>

in order to access

Microsoft.VisualBasic.Compatibility.VB6.<anything>

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
N

Nikolay Petrov

Actually i am trying to make a new VB .NET app, using code from converted
VB6 app
and I didn't know how to write new code to replace the "VB6" thing, so i
just copied it and it show this error.
 
N

Nikolay Petrov

I have added "'Microsoft.VisualBasic.Compatibility" to a new project, so i
can copy old code to the it, but the following error occurs:
"Namespace or type 'Compatibility' in the project-level Imports
Microsoft.VisualBasic.Compatibility' cannot be found."
 
A

Armin Zingler

Are you looking for a replacement of the compatibility library - it's
"better" to use it only for upgraded projects - or do you want to know how
to achieve to use it?
I have added "'Microsoft.VisualBasic.Compatibility" to a new project,
so i can copy old code to the it, but the following error occurs:
"Namespace or type 'Compatibility' in the project-level Imports
Microsoft.VisualBasic.Compatibility' cannot be found."


In the solution explorer, you've got "Microsoft.VisualBasic.Compatibility"
under the "references" node? And you really have
"Microsoft.VisualBasic.Compatibility" (w/o quotes) as an import at project
level?
Using VB 2003, if you double-click on the library in the solution explorer,
it jumps to the object browser and selects the library. Under that node, the
containsd namespaces are listed. Which namespaces do you see?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
N

Nikolay Petrov

I need a replacemnt of the upgraded code. But my lack knowledge prevents me
to replace it with vb .net alternative. So i have to use the upgraded VB6
code in new apps, which in most cases doesn't work.
 
A

Armin Zingler

N

Nikolay Petrov

I've tried to copy code from the converted project to a brand new
then i get this error
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top