Solved

Visual Basic To .NET

Posted on 2003-11-07
12
254 Views
Last Modified: 2013-12-04
How Do you transfer Visual Baisc Code to .NET coding?
0
Comment
Question by:ptphil54
  • 3
  • 2
  • 2
  • +2
12 Comments
 

Author Comment

by:ptphil54
ID: 9701482
This is Semi-Urgent. College Student with 2 semesters of VB under their belt!
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 63 total points
ID: 9701641
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.!!!!


AW

0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 62 total points
ID: 9705301
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.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9707586
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.

AW
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 69

Expert Comment

by:Éric Moreau
ID: 9710071
>>but rather PURE .NET controls

What you said is true for intrinsic controls but have you tried datagrid, dbcombo, imagecombo, ...
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9712203
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.

AW
0
 
LVL 2

Expert Comment

by:selim007
ID: 9721050
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!!!
0
 
LVL 5

Expert Comment

by:TRUENEUTRAL
ID: 9733953
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... :)
0
 
LVL 5

Expert Comment

by:TRUENEUTRAL
ID: 10322094
Please do NOT accept my joke as the answer.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now