Visual Basic To .NET

How Do you transfer Visual Baisc Code to .NET coding?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ptphil54Author Commented:
This is Semi-Urgent. College Student with 2 semesters of VB under their belt!
open Visual Studio.NET 2003, then under the File menu, select the Open/File and navigate to the path of the VB 6 .vbp file.  That will invoke the Upgrade wizard which will then attempt to convert the Code and forms in the VB 6 project to VB.NET.  when the 'upgrade' is complete, a report will be generated. indicating any task that remain to be carried out manually.  You will also find these tasks on the Tasks Tab at the bottom of the VS screen.

just did this with a fairly sophiticated app (VB 6) that I downloaded from the web, and all of the code, EXCEPT four lines in one form upgraded perfectly.  The code that did not was of very minor significance, so the upgraded .NET version runs almost perfectly, and the upgrade required about 5 minutes.!!!!


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
I don't believe that VB6 can be well upgraded to .Net.
-wrappers are added around VB6 controls to be used in .Net (meaning that you will need to deploy the controls and VB6 runtimes). XCopy deployment and no-touch deployement won't work.
-Code won't use new features such as inheritance, polymorphism, new controls, ...
-Many lines won't be upgraded.

Having said that, I consider that you better rewrite your app or simply keep it in VB6.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

actually, the controls upgrade VERY cleanly, and are NOT wrappers around the OCX's, but rather PURE .NET controls (at least for the standard toolbox controls - Text Box, Command Button, CHeck Box, etc)

Actually VS 2003 does a VERY good job - as I said, I had one recent downloaded VB 6 app, not TERRIBLY sophisticated, but a demo for a Matrix Manipulation library, which upgraded almot 100% - only 4 lines on one minor form, an those were of little of n significance.  When i simply commented out the failed lines, the pp run perfectly, fiirst time I pressed f5!!!.

Yes, it is true that "Code won't use new features such as inheritance, polymorphism, new controls, ..", but it will get you started,  And I agree that it would be best to ONLY use the upgrade wizard under VERY VERY controlled situations.  Do not use it to 'upgrade' a real, Mission critical app.  And do not expect to get the full advantage of .NET when you do upgrade.

Éric MoreauSenior .Net ConsultantCommented:
>>but rather PURE .NET controls

What you said is true for intrinsic controls but have you tried datagrid, dbcombo, imagecombo, ...
no, but I avoid the Databoyund controls like the plague.  I prefere to do ALL data handling and display is unbouind controls, so the I control exactly what happens and when.  And trying to use data bound controls from VB6, in a .NET app is an invitation to disaster.  .NET's approach to 'data-bound' controls is 100% diametrically opposite to that used in VB 6, and the use of recordsets (or in the .NET case Datasets, Datareaders, etc) is so different, that any attempt to move from the former tot latter is again inviting disaster.

As we have both said, "it would be best to ONLY use the upgrade wizard under VERY VERY controlled situations", and Databound controls are OUTSIDE those parameters, in my mind.

Attempting to 'upgrade' any really 'significant' VB 6 application is a serious MISTAKE, and should be considered as the sign of a total lack of understanding of the nature of the .NET platform and paradigm.

i agree on that Arthur_Wood,
.Net is completly different from the previous versions of visual studio.
it's not recommended to upgrade projects from vb6 to .net if the application is very complex and contains many 3rd party controls and dlls.
otherwise, if it's a simple application, you can easly upgrade it, few lines may fail to upgrade then u'll have to do it manually.
i have many applications built on vb6, now i am switching to .net and rebuilding everything from the ground up!!!
Hey, just look at this as an opportunity to refactor all that crappy code you wrote years ago when you were in a hurry. Uhh... well... maybe you are still in hurry... in that case, look at it as an opportunity to write new crappy code based on old crappy code... :)
Please do NOT accept my joke as the answer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.