locked
convert vb6 to c# RRS feed

  • Question

  • Hi Friends ,

    I Have a Large Project in vb6,

    I want to convert to c#.net 

    Do you Have a Good Solution for convert . I Have a many dll and ocx , Active x and ....

    Tuesday, August 8, 2017 6:50 PM

All replies

  • The conversion from such a project (which is in fact more OCX then VB) is a little bit more difficult using C$ then from VB6 to VB7

    But for help you can be better ask this in the C# forums. This forum handles no C# code. 

    Although the result is the same.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral

    I guess a moderator will move this thread


    Success
    Cor



    Tuesday, August 8, 2017 7:05 PM
  • Hello,

    VB6 and any of the .NET languages are like night and day, even VB.NET and with that said I would strongly advise selecting either C# or VB.NET. Once the language is selected don't simply try to rewrite your program but instead decide if you are sticking with desktop projects or moving to say web application.

    Once this is know learn the language, C# or VB.NET for desktop while web apps you will need to learn JavaScript, CSS and HTML.

    Next up is to decide how to store data then what method to work with data. For instance let's say you decide on SQL-Server, working with data could be done with a managed data provider like SqlClient or you might decide to use Entity Framework.

    Bottom line is not to dig into a rewrite while learning.

    Lastly, don't go looking for a project converter, this will bite you down the road in one or more ways.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, August 8, 2017 7:05 PM
  • There is no conversion from VB6 to C#. The only thing you can do is look at the VB6 functionality and duplicate it somewhat in C#. But C# is an entirely different animal. I hope you know something about C# and object oriented programming. I worked on a conversion from VB6, a very large project, over to VB.NET with the VB6 solution using a lot of ActiveX, ocx, etc., etc. We just rewrote the whole thing in VB.NET making sure the functional aspects stayed the same as the legacy VB6 solution.

     

    Tuesday, August 8, 2017 10:35 PM
  • There is no easy solution to convert VB6 programming to either C# or VB.Net.

    The only practical way is to re-write from scratch.

    Which means you have to decide whether it is worth spending the time to convert the project.
    VB6 is still supported on Windows 7, Windows 10 and Windows Server until at least 2025.

         Microsoft VB6 support statement

    Wednesday, August 9, 2017 5:11 AM
  • There is no easy solution to convert VB6 programming to either C# or VB.Net.

    The only practical way is to re-write from scratch.

    Which means you have to decide whether it is worth spending the time to convert the project.
    VB6 is still supported on Windows 7, Windows 10 and Windows Server until at least 2025.

         Microsoft VB6 support statement

    For those reading this pay attention to that it is not about VB as tool, that is already 8 years not more supported.

    There is no way you can edit those programs for instance at a tax change then with keeping an old computer with an old OS available to make the native code (which needs in VB the runtime)

    It is about the runtime. but: "The Visual Basic 6.0 runtime to is defined as the compiled binary files originally included in the redistribution list for Visual Basic 6.0. These files were marked as distributable in the original Visual Basic 6.0 license. Examples of these files include the Visual Basic 6.0 runtime library (msvbvm60.dll), controls (i.e., msflxgrd.ocx) along with runtime support files for other major functional areas (i.e. MDAC)."

    Everything outside this, for instance often used 3rd party OCX controls fall not in this statement

    Yea and when that old computer falls down, you're in trouble. 


    Success
    Cor




    Wednesday, August 9, 2017 9:09 AM
  • I would convert it to VB.NET first, then to C# using many of the available VB.NET to C# conversion tools available. Much of the core language in VB 6 is supported in VB.NET; however, you will need to re-write some of the code.

    There is no direct conversion from VB 6 to C#, so that would require a total re-write.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, August 9, 2017 11:57 AM
  • Hi ALl_Delavari,

    Microsoft provide way to migrate VB6 to VB.NET. But it needs earlier version of Visual Studio.

    Please check the following link.

    https://msdn.microsoft.com/en-us/library/aa239677(v=vs.60).aspx

    https://msdn.microsoft.com/en-us/library/bszew91f(v=vs.120).aspx

    After that you could convert VB.NET to C#. There are many tools online to convert vb to c#. You could take the following link for reference.

    http://converter.telerik.com/

    https://www.carlosag.net/tools/codetranslator/

    If you have any questions when you convert vb to c#, please feel free to contact us.

    Best Regards,

    Wendy

    Note: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. 

    Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 10, 2017 2:21 AM

  • VB6 is still supported on Windows 7, Windows 10 and Windows Server until at least 2025.

         Microsoft VB6 support statement

    For those reading this pay attention to that it is not about VB as tool, that is already 8 years not more supported.

    There is no way you can edit those programs for instance at a tax change then with keeping an old computer with an old OS available to make the native code (which needs in VB the runtime)


    Everything outside this, for instance often used 3rd party OCX controls fall not in this statement

    Yea and when that old computer falls down, you're in trouble. 


    Success
    Cor




    The VB6 programming IDE installs and runs on Windows 7, Windows 8 and Windows 10.

    You don't need to keep an old computer with an old OS.

    Microsoft have never supported 3rd party OCXs so there is no surprise that they " fall not in this statement"

    VB6 just runs on all versions of Windows from 95 to Windows 10.


    Thursday, August 10, 2017 5:49 AM

  • VB6 just runs on all versions of Windows from 95 to Windows 10.


    You are again misusing VB6. You mean Visual studio 1998 (or VS6) which contains the build engine of that version. Be aware the code used is almost the same as in the 2002 version. Only different are things in the way of the storage of the form and the default use of .Net instead of Com. (And some changes in code but fewer than between version 5 to 6. )

    Yea it is good you report this. There are more unwanted programs made unavailable on Windows 10 while they could run fine (games). 

    Strange they don't do that with Visual Studio 1998.

    But maybe they do it now you have paid attention to it. 


    Success
    Cor



    Monday, August 14, 2017 10:39 AM

  • VB6 just runs on all versions of Windows from 95 to Windows 10.


    You are again misusing VB6. You mean Visual studio 1998 (or VS6) which contains the build engine of that version. Be aware the code used is almost the same as in the 2002 version. Only different are things in the way of the storage of the form and the default use of .Net instead of Com. (And some changes in code but fewer than between version 5 to 6. )

    Yea it is good you report this. There are more unwanted programs made unavailable on Windows 10 while they could run fine (games). 

    Strange they don't do that with Visual Studio 1998.

    But maybe they do it now you have paid attention to it. 


    Success
    Cor



    The VB6 Runtime is included in Windows 10. VB6 applications run on Windows 10 (and will until at least 2025).    Microsoft Support Statement for VB6 on Windows 10

    The VB6 programming IDE (Visual Basic 6.0  Enterprise Edition or Professional Edition, or Visual Studio 6.0  Enterprise Edition or Professional Edition) installs and runs on Windows 7, Windows 8 and Windows 10. You can download Visual Basic 6.0 Enterprise Edition if you have an MSDN subscription.

    You don't need to keep an old computer with an old OS.

    VB6 just runs on all versions of Windows from 95 to Windows 10.

    Monday, August 14, 2017 7:28 PM
  • ...a Large Project in vb6,

    I want to convert to c#.net 

    ....

    my advice, don't convert.

    rewrite them, using current best design and practice

    why u want to convert them? so that it will be in "good" maintainable status?

    if u convert them, it won't be in "good" state, i bet there will be stuffs in it so outdated in term of design, and 3rd party dependency.


    Tuesday, August 15, 2017 2:36 AM
  • Hello Ali,

    By "Large Project in vb6" having "many dll and ocx" I assume you are talking about a system made up of  hundreds of files, possibly multiple inter-related VBPs, and at least 250K LOC. A system like this typically contains thousands of hours of work accumulated over years of development and enhancement. 

    Just estimating and planning the work needed to rewrite something this big from scratch is a very expensive and difficult task.  Most companies that take the time to prepare an honest estimate for such a project find a from-scratch rewrite is simply not feasible: it is too disruptive, too costly, and too risky.  The reason for this is two fold: first, large legacy systems contain a lot of functionality; and second, learning and deciding how to use .NET in general and for your upgrade in particular is also a lot of work. Both tasks are absolutely required for a big VB6-to-C# upgrade.  

    Let's consider the first task: reproducing all that legacy functionality.
    One way to get a handle on all that functionality is to "cash in" the legacy code. The legacy code is a production-tested, formal specification of the information model and business rules you must reproduce.  It also contains myriad details describing how the system works and how it interfaces with external systems and users.  Using the source code can save you a lot of effort of requirements gathering and operating environment analysis.  BUT, reading 100s of thousands of lines of legacy code, interpreting it in your head, and re-expressing it all by hand is extremely tedious and error prone.  Here is where software analysis and re-engineering tools help.  Initially, these tools can help you analyze the code.  They can also give you a preliminary .NET translation that you can inspect and navigate using Visual Studio and other .NET-based code analysis tools.  Later on, these tools will be help you read, interpret, and rewrite the code in .NET and give you something you can take forward.

    Let's consider the second task: learning .NET and deciding how to use if for your upgrade.
    A tool cannot learn for you; the upgrade team needs to learn .NET, and ideally they should have a lot of experience with .NET before starting the upgrade.  However, the upgrade effort is sure to bring new problems and options for solutions.  The best upgrade tools are extremely fast, accurate, and above all, flexible.  These tools allow the team to deal with the specific problems and ambiguities in their source code, experiment with different re-design options, and automatially refactor and cleanup results to follow their specific .NET coding standards and to include the specific upgrade features they want.  

    Generally speaking, the "quality" of upgraded code is constrained by the experience/preferences of the upgrade team, and by the resources (time, money) they have to work with.  Teams using upgrade tools to help them read, interpret, and re-implement their legacy code can do more re-engineering than teams working completely from scratch.  

    Microsoft suggests several tools in this article. The one from Great Migrations has a free Trial.  VB6 Upgrade tools on MSDN

    Disclaimer: I work for Great Migrations. There is a lot more to discuss. Please visit Great Migrations Portal for more articles and to get the gmStudio Trial




    • Edited by MarkJuras Friday, January 5, 2018 2:34 AM fixed hyperlinks
    Friday, January 5, 2018 2:30 AM
  • This is time consuming and depends on quality of code. Sometimes expensive too

    You may try

    SELISE Phoenix

    phoenix.selise.ch



    • Edited by mehrnh Thursday, August 13, 2020 11:48 AM
    Thursday, August 13, 2020 11:47 AM
  • You may try phoenix.selise.ch

    Fully functional code!

    Full disclosure: I work for SELISE

    Thursday, August 13, 2020 5:02 PM
  • Phoenix is a service that can help companies convert their software running on VB6, or Real Visual Basic, into C#.

    It is cheaper than most companies converting legacy code.

    Sunday, August 16, 2020 9:07 AM
  • phoenix.selise.ch
    Sunday, August 16, 2020 9:21 AM
  • Hi,

    Often times large solution conversion does not take into account full code functionality post conversion. There is a company called mobilize.net which does this, but charges quite a bit of money. You can also try SELISE phoenix (phoenix.selsie.ch) for converting VB6 code to C#. Their post conversion support is excellent.

    Happy converting!

    Monday, August 17, 2020 9:59 AM
  • Hi,

    Often times large solution conversion does not take into account full code functionality post conversion. There is a company called mobilize.net which does this, but charges quite a bit of money. You can also try SELISE phoenix (phoenix.selsie.ch) for converting VB6 code to C#. Their post conversion support is excellent.

    Happy converting!

    Monday, August 17, 2020 10:03 AM