Using a .BAS file in VB.NET

S

Shacker

Hi,

A collegue of mine and I have a matter that needs to be settled...

We have old VB6 code that uses a common SQL connection module and it's
used widely in all of our VB6 code.

We're now writing Windows services in VB.NET that needs to make a SQL
connection.

Can we simply add the VB6 SQL connection module (conn.bas) to the
VB.NET project and call the procedures within them (my collegues
contention) or recreate the SQL connection module functionality in a
VB.NET module / class file, then add the class file to the VB.NET
project (my contention)?

Thanks!
 
C

Chris

Shacker said:
Hi,

A collegue of mine and I have a matter that needs to be settled...

We have old VB6 code that uses a common SQL connection module and it's
used widely in all of our VB6 code.

We're now writing Windows services in VB.NET that needs to make a SQL
connection.

Can we simply add the VB6 SQL connection module (conn.bas) to the
VB.NET project and call the procedures within them (my collegues
contention) or recreate the SQL connection module functionality in a
VB.NET module / class file, then add the class file to the VB.NET
project (my contention)?

Thanks!


If you compile the .bas file into a com dll then you can reference and
use it in your project. You can not just add the .bas file to the
VB.NET project and use the VB6 code. Best to port it over to VB.NET.

Chris
 
B

Bernie Yaeger

Hi Shacker,

I see no reason why you couldn't rebuild the code into a module in a .net
app and use the connection globally from there (which was your contention, I
believe). I don't believe you can use the .bas file in its original form,
unless, as Chris suggests, you compile it into a com dll, which is not, in
my view, the best approach.

HTH,

Bernie Yaeger
 
C

Cor Ligthert [MVP]

Shacker,

The least I would do is investigation as Bernie wrote, by just changing. Bas
in VB and see what errors I got.

(You know that there is in Tools a fuction to translate snippets of VB6 code
to Net?)

I hope this helps,

Cor
 
B

Bernie Yaeger

Hi Cor,

I noticed your MVP status on another post and sent a congratulatory message
there, but I want to be sure you get it - you are the most helpful and the
most considerate person on these ng's and I am so happy for your well
deserved achievement. Congrats!!!

Bernie
 
S

Shacker

Thank you everyone for their response!!

The .DLL / COM object solution works (as Chris mentioned) and that's
what we'll go with until I get a chance and rewrite the VB6 module in
..NET.

Thanks again!!
 

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