VB6 to C# Conversion using VB2005 Express

I convert VB6 using VBUpgrade in VB2005 and paste all controls to C#. All properties are the same from VB2005 to C#.

My problem is...my controls (e.g. labels) are not aligned in VB6 when I compare the VB6 form and C# form by setting the two form location to 0,0 then switch to one window to another ( Alt + Tab ).

Please help me on how to formulate that problem.

-bachie

bachelor_1919@yahoo.com




Answer this question

VB6 to C# Conversion using VB2005 Express

  • Evg

    Actually that is my last resort but I imagine if you are handling more than 800 programs and each programs may contains several forms and each form having several controls that you manually align.

    I tried to get help that helps me to give an idea on how to formulate that problem because I know I'm not the only one experiencing that conversion problem.

    Actually, I developed several tools that can modify the 800 programs that may have the same changes. So that, it is more efficient than manual.

    Thanks.



  • LegoZeBoGossOuPresque

    Yes, dragging them to the right place is the way to go. Note that the fonts of your VB6 components usually change; .NET only supports TrueType fonts and the standard VB6 font "MS Sans Serif" is not TrueType. This may cause things to get a bit out of whack.



  • Globalog

    from the forms designer manually dray the labels to the position that you wish them to be in and then anchor them accordingly

  • Ir0nClad

    My question is: why are you upgrading all these programs Upgrading brings absolutely nothing (very little) to the table. you are going to have to debug every single one of them (again).

    I presume the reason is to continue to improve them: I can imagine (out of necessity) upgrading one or two programs, but why don't you simply modify the programs to accept components written in C# (if that's your language of choice; C#,VB makes no difference)

    The VB6 runtime is not going away for a good few years, even on Windows Vista. Additionally, are you ultimately upgrading to version 2003 I don't understand the business decision to do so, beyond spending a load of money (actually, there is no valid business decision to do so, beyond a learning/R&D decision - like building a bicycle with a jet engine to get to the cafeteria faster - it'll save time and money).

    I'm actually quite interested to know the thinking involved in doing such a thing.



  • KimTrang

    This is the code that will solve my problem. Posted by David Anthon but I dont know how to use or where to put the code in my C#.NET 2003 program.

    Please help me on this.

    namespace My
    {
    internal partial class MyApplication: Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase
    {
    [global::System.Diagnostics.DebuggerStepThrough()]
    public MyApplication(): base(Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
    {
    this.IsSingleInstance = false;
    this.EnableVisualStyles = true;
    this.SaveMySettingsOnExit = true;
    this.ShutdownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses;
    }

    [global::System.Diagnostics.DebuggerStepThrough()]
    protected override void OnCreateMainForm()
    {
    this.MainForm = new Form1();
    }

    [STAThread]
    static void Main(string[] args)
    {
    MyApplication MyApp = new MyApplication();
    MyApp.Run(args);
    }
    }
    }



  • VB6 to C# Conversion using VB2005 Express