I am helping convert a Visual Basic project to C#. The following is the original VB code in the Application.Designer.cs document:
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34014
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = False
Me.EnableVisualStyles = True
Me.SaveMySettingsOnExit = True
Me.ShutdownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.ePlanSysOman.frmMain
End Sub
End Class
End Namespace
The following is code that was the result from an online VB to C# converter:
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.ApplicationServices;//I added this in
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;//I added this in
namespace My
{
//NOTE: This file is auto-generated; do not modify it directly. To make changes,
// or if you encounter build errors in this file, go to the Project Designer
// (go to Project Properties or double-click the My Project node in
// Solution Explorer), and make changes on the Application tab.
//
internal partial class MyApplication
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
public MyApplication() : base(global::Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
{
this.IsSingleInstance = false;
this.EnableVisualStyles = true;
this.SaveMySettingsOnExit = true;
this.ShutdownStyle = global::Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses;
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
protected virtual void OnCreateMainForm()//I changed "override" to "virtual"
{
this.MainForm = global::ePlanSysOman.frmMain;
}
}
}
The properties that are not found are the following:
this.IsSingleInstance
this.EnableVisualStyles
this.SaveMySettingsOnExit
this.ShutdownStyle
this.MainForm
I looked each one up and I have the correct namespaces and assemblies for them. Two more issues I am having is with:
base(global::Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
//I receive the following error: "object' does not contain a constructor that takes 1 arguments
and
global::ePlanSysOman.frmMain
//I receive the following error: 'ePlanSysOman.frmMain' is a 'type', which is not valid in the given context
The VB code is error free. Only the C# code contains errors. I am not too familiar with either languages and any advice to help solve these errors will greatly be appreciated.