none
Need help on Vb.net code RRS feed

  • Question

  • Hi, I need help guys. I am migrating Vb6 code to Dot Net and I have an issue. In VB6, below code tell us that weather application run as standalone mode or as an ActiveX object. so what is the equivalent for App. StatrtMode in Vb.Net. I hope you guys would me.  
     If App.StartMode = vbSModeStandalone Then
            Dim args() As String
            GetCommandLine args()
            GetArgs args()
    end if


    Thursday, May 3, 2018 4:05 PM

All replies

  • Do you have an expectation that the .Net app is to run as an active x object for some reason? I've never heard of an App.StartMode in .Net.

    Typically you compile apps in .Net to be single instance applications or not. That is the only equivalent possibility of App.StartMode I can think of. But then I don't know VB6 or less either.

    Also I've found threads that say "ActiveX controls are supported in .NET thought there is some additional work needed to get to run.

    In your case however, the .NET framework does not support starting as ActiveX.  You can install a control if it is signed (this is one of the extra steps needed) but starting as ActiveX is not supported.".


    La vida loca

    Thursday, May 3, 2018 4:31 PM
  • In slight other words than mr. Monkeyboy told it, because in fact it is not important what the technical base is for your question. 

    "Why do you need it?"


    Success
    Cor

    Thursday, May 3, 2018 4:40 PM
  • 
    In your case however, the .NET framework does not support starting as ActiveX.
    You can install a control if it is signed (this is one of the extra steps 
    needed) but starting as ActiveX is not supported.".
    
    Would you be more specific on your explanation.. 
    what control that I need to install?
    I know that app.StartMode object is not supported dot net , I am asking for 
    alternate which I can use.
    

    Thursday, May 3, 2018 4:44 PM
  • 
    In your case however, the .NET framework does not support starting as ActiveX.
    You can install a control if it is signed (this is one of the extra steps 
    needed) but starting as ActiveX is not supported.".
    
    Would you be more specific on your explanation.. 
    what control that I need to install?
    I know that app.StartMode object is not supported dot net , I am asking for 
    alternate which I can use.

    Again, it seems unclear for you. 

    For what you need it. To tell in an anology: "I had a cassette tape player and now I need an the rewind button on my phone" gives few information"

    Not everybody did use what you used in history you know.


    Success
    Cor



    Thursday, May 3, 2018 5:33 PM
  • The point they are making is that the EXE you release as a desktop application will never run as an ActiveX component, so there is no need to do this test.

    If you want to offer your application as an ActiveX component, that will be a separate version of the program.

    Since you would have two different programs, each one would know that it is either the desktop version or the ActiveX version.

    https://www.codeproject.com/articles/24089/create-activex-in-net-step-by-step


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, May 3, 2018 5:35 PM
    Moderator
  • Yea but it can also be meant as to verify if it is a single instance executable. 

    It is the same as if I would write to you: "Waarvoor doe je dit Reed?"

    Correct language but in the wrong place.  :-)


    Success
    Cor


    Thursday, May 3, 2018 7:01 PM
  • 
    In your case however, the .NET framework does not support starting as ActiveX.
    You can install a control if it is signed (this is one of the extra steps 
    needed) but starting as ActiveX is not supported.".
    
    Would you be more specific on your explanation.. 
    what control that I need to install?
    I know that app.StartMode object is not supported dot net , I am asking for 
    alternate which I can use.

    I believe that statement means you can install an ActiveX control if it is signed but starting as ActiveX, an app, is not supported. Which is why there is no alternate for what you desire except what Reed Kimble points out I believe.

    Also people would wonder why a program was converted from VB6 to VB.Net but did not make use of .Net controls rather than 20 yoa ActiveX controls from VB6. Converting means to me not mixing parts together but changing from old to new.

    I suppose a hot rod builder may put a new engine like a vette engine in a car but why use a carburetor when programmable fuel injection is available? Just because they don't understand or know about fuel injection?


    La vida loca

    Thursday, May 3, 2018 8:23 PM
  • The code was written for an ActiveX EXE application, which will run either as a standalone app or through COM (or ActiveX) automation. This type of application is not supported natively in .NET, but it is possible to code an app that runs like an ActiveX EXE. I know of a project for this purpose.

    In any event, you can remove the StartMode check. It won't be relevant for a standard Windows Forms app. The below link demonstrates how to retrieve the application command line arguments:

    https://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs(v=vs.110).aspx


    Paul ~~~~ Microsoft MVP (Visual Basic)


    Thursday, May 3, 2018 8:24 PM
  • Hi adushetty,

    Here is an article about the differences between VB6 and .NET controls and the problems you can find in migrating VB6 applications with user-interface. For StartMode, it said that the .NET Framework doesn’t support ActiveX EXE application, therefore this property is always equal to 0-vbSModeStandalone for EXE projects or equal to 1-vsSModeAutomation for DLL projects.

    http://www.vbmigration.com/Resources/detmigratingfromvb6controls.aspx?Id=19

    Hope to help you a bit.

    Best Regards,

    Cherry


    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.

    Friday, May 4, 2018 6:18 AM
    Moderator
  • Thanks for all your replies..
    Monday, May 14, 2018 3:56 PM
  • Hi adushetty,

    If you have solved your issue, please remember to close your thread by marking the helpful post as answer, you can also share your solution here, it is beneficial to other community members who face the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry


    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.

    Tuesday, May 15, 2018 6:52 AM
    Moderator