Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7407657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:45:43+00:00 2026-05-29T05:45:43+00:00

I am trying to convert a VB.NET project to C#. I am conveting all

  • 0

I am trying to convert a VB.NET project to C#.
I am conveting all the forms and classes as required, but I don’t know where I need to write the events from ApplicationEvents.vb (I believe its autoGenerated from Properties)

Here is the code in my ApplicationEvent.vb file:

Imports GM.Powertrain.RemoteCopy.Interfaces
Imports System.Runtime.Remoting.Channels.Tcp
Imports System.Runtime.Remoting.Channels

Namespace My
   Partial Friend Class MyApplication
      Private Shared serviceConfig As ServiceConfig =
         serviceConfig.Load()

      Protected Overrides Function OnStartup(
            ByVal eventArgs As StartupEventArgs) As Boolean
         Dim channel As TcpChannel = New TcpChannel()
         ChannelServices.RegisterChannel(channel, False)
         Me.MainForm = New Computer_Network_MAIN_SCREEN()
         Return MyBase.OnStartup(eventArgs)
      End Function

      Public ReadOnly Property Config() As ServiceConfig
         Get
            Return serviceConfig
         End Get
      End Property

      Public ReadOnly Property LocalMachine() As IRemoteCopier
         Get
          Return serviceConfig.GetObject(Of IRemoteCopier)("localhost")
         End Get
      End Property
   End Class
End Namespace

Also, any tips that may help on this conversion would be appreciated.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:45:44+00:00Added an answer on May 29, 2026 at 5:45 am

    Visual Studio 2010 creates Program.cs file for C# application projects.

    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
    }
    

    Application.Run() would, if this was VB.NET, fire “Startup” event. In this case, you don’t need to catch that event because you control when is the application going to run using the code specified above.

    If you want to subscribe to the event fired when the application is about to close, use this code:

    Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
    

    and then define the function to handle this event:

    static void Application_ApplicationExit(object sender, EventArgs e)
    {
        // your shutdown code here ...
    }
    

    As a result, your code should look something like this:

    using GM.Powertrain.RemoteCopy.Interfaces; 
    using System.Runtime.Remoting.Channels.Tcp; 
    using System.Runtime.Remoting.Channels; 
    
    namespace ProjectName
    {
        static class Program
        {
            private static ServiceConfig serviceConfig = serviceConfig.Load();
    
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                TcpChannel channel = new TcpChannel();
                ChannelServices.RegisterChannel(channel, false);
    
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new frmMainCard());
                Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
            }
    
            public static ServiceConfig Conifg
            {
                get { return serviceConfig; }
            }
    
            public static IRemoteCopier LocalMachine
            {
                get { return serviceConfig.GetObject<IRemoteCopier>("localhost"); }
            }
    
            static void Application_ApplicationExit(object sender, EventArgs e)
            {
                throw new NotImplementedException();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert a ASP.NET project to Entity framework. How to re-write
I am trying to convert an ASP.NET website into a web application project. The
I'm trying to convert quite big project from .net 3.5 to .net 4.0 and
I'm trying to convert an ASP.NET web application to use resource files. I haven't
I'm trying to convert some Xaml to HTML using the .NET XslCompiledTransform and am
I'm trying to convert a function in C# to VB.Net 2008 and can't seem
I am new to ASP.NET and am trying to convert a web application from
I found the following syntax as a VB.NET property and I'm trying to convert
Question: I'm trying out to convert this here: http://support.microsoft.com/kb/828736 to VB.net I got it
i´m using subsonic 3 trying convert a SQL2008 project to MySQL. when the projects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.