Error Created when opening beta 1 file in beta 2

How to solve this error?

i have save the file in beta 1 and when i upgrade to beta 2 I have this following error can some one please help me on this?

Error 1 Type 'System.Windows.Forms.WindowsFormsApplicationBase' is not defined.
Error 2 'AuthenticationMode' is not a member of 'Forms'.
Error 3 'ShutdownMode' is not a member of 'Forms'.
Option
StrictOn

OptionExplicitOn

NamespaceMy

PartialClass MyApplication

InheritsSystem.Windows.Forms.WindowsFormsApplicationBase

<Global.System.Diagnostics.DebuggerStepThrough()>PublicSubNew()

MyBase.New(System.Windows.Forms.AuthenticationMode.Windows)

Me.IsSingleInstance =false

Me.EnableVisualStyles =true

Me.ShutDownStyle =System.Windows.Forms.ShutdownMode.AfterMainFormCloses

EndSub

<Global.System.Diagnostics.DebuggerStepThrough()>ProtectedOverridesSub OnCreateMainForm()

Me.MainForm =My.Forms.Form1

EndSub

EndClass

EndNamespace

[3018 byte] By [Rubber] at [2008-2-1]
# 1
Rubber wrote:

How to solve this error?

i have save the file in beta 1 and when i upgrade to beta 2 I have this following error can some one please help me on this?

Error 1 Type 'System.Windows.Forms.WindowsFormsApplicationBase' is not defined.
Error 2 'AuthenticationMode' is not a member of 'Forms'.
Error 3 'ShutdownMode' is not a member of 'Forms'.
Option
Strict On

Option Explicit On

Namespace My

Partial Class MyApplication

Inherits System.Windows.Forms.WindowsFormsApplicationBase

<Global.System.Diagnostics.DebuggerStepThrough()> Public Sub New()

MyBase.New(System.Windows.Forms.AuthenticationMode.Windows)

Me.IsSingleInstance = false

Me.EnableVisualStyles = true

Me.ShutDownStyle = System.Windows.Forms.ShutdownMode.AfterMainFormCloses

End Sub

<Global.System.Diagnostics.DebuggerStepThrough()> Protected Overrides Sub OnCreateMainForm()

Me.MainForm = My.Forms.Form1

End Sub

End Class

End Namespace

Rubber,

I believe the namespace for the class has been changed to:

Microsoft.VisualBasic.ApplicationServices

You should be able to change the namespace and it should work.

Hope this helps.

- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

casperOne at 2007-8-21 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
I don't fully understand what is happening here, but I have a solution.

Go Edit > Find and Replace > Quickfind

Search for 'Namespace' in the current project and that will take you to the problem section of code.

Copy & Past this section of code below over the code that was generated by Beta1, but replace the ######### with the name fo your startup object (I have left .Form1 in to give you a better idea of what this line does because for most smalls apps it will be Form1).


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 on the My Project node in the
' Solution Explorer), and make changes on the Application tab.
'

Partial Class MyApplication

<Global.System.Diagnostics.DebuggerStepThrough()> _
Public Sub New()
MyBase.New(Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub

<Global.System.Diagnostics.DebuggerStepThrough()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.#########.Form1
End Sub

End Class

End Namespace

Following this both my little apps that I wrote in Beta1 now work under Beta2.

Blisardo at 2007-8-21 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3
Hi,
This also happens in other languages (C#, C++/CLI) when upgrading it to Beta 2...
I guess some functionalities in Beta 1 have been dropped or "renamed"...
I really hope that someone would blog on how to convert your Beta 1 Apps to Beta 2...
cheers,

Paul June A. Domag

PaulDomag at 2007-8-21 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4

Hi,

The error you are seeing is a result of namespace changes that were made between Beta 1 and Beta 2. Although you can simply globally replace System.Windows.Forms.[WindowsFormsApplicationBase/ShutdownMode/AuthenticationMode/etc] with Microsoft.VisualBasic.ApplicationServices to mitigate these errors, you may want to have Visual Studio regenerate the files for you.

Here's how you can do that:
- Select "Show All Files" in the Solution Explorer
- Rename "MyApplication.myapp" to "Application.myapp"
- Remove "MyApplication.vb" (This is the file that's likely giving you errors)
- Right-click "Application.myapp" and select "Run Custom Tool"
- Rename "MyResources.resx" to "Resources.resx"
- Remove "MyResources.vb"
- Right-click "Resources.resx" and select "Run Custom Tool"
- Rename "MySettings.settings" to "Settings.settings"
- Remove "MySettings.vb"
- Right click "Settings.settings" and select "Run Custom Tool"
- Rename "MyEvents.vb" to "ApplicationEvents.vb"

These steps will effectively upgrade your project to match the structure that's used in Beta 2 (and RTM). It's a somewhat annoying process, but (for what it's worth...) you only have to do it once per project.

Additionally, you may run into compilation errors in your code because other types in My have changed namespaces. Here's a quick list:

The following types in System.IO have been moved to Microsoft.VisualBasic.FileIO
-TextFieldParser
-FileSystem
-SpecialDirectories
-MalformedLineException
-UIOption
-UICancelOption
-SearchOption
-RecycleOption
-FieldType
-DeleteDirectoryOption

The following types in System.Diagnostics have been moved to Microsoft.VisualBasic.Logging:
- FileLogTraceListener
- Log
- LogFileCreationSchedule
- LogFileLocation
- DiskSpaceExhaustedOption

The following types in System.Windows.Forms have been moved to Microsoft.VisualBasic.ApplicationServices:
- ApplicationBase
- AssemblyInfo
- AuthenticationMode
- BuiltInRole
- BuiltInRoleConverter
- ConsoleApplicationBase
- ShutdownMode
- WindowsFormsApplicationBase

You may also receive compilation errors for the following types, which now live in the Microsoft.VisualBasic.Devices namespace:
- Audio
- Clock
- Computer
- ComputerInfo
- Keyboard
- Mouse
- Network
- NetworkAvailabilityEventArgs
- Ports
- ServerComputer

We really appreciate your early adoption of VB Whidbey, and realize that these sorts of change are a big pain in the pain place... Sorry 'bout that. The changes were made in response to customer feedback that the previous organization was confusing, and we wanted to get things right for the final release of Whidbey.

Don't hesitate to let me know if you run into any similar issues.

Thanks!

Joe Binder
The VB Team

Joe_MS at 2007-8-21 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5

When I converted from Visual Studio 2005 Beta 1 to Visual Basic Express Edition Beta 2 I created a new project and just added existing items from the old project to the new one (forms and classes). The project builds successfully, but when I try to execute I get the following error when it tries to open the startup form:

System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"Probate.frmHCPLogo.resources\" was correctly embedded or linked into assembly \"Probate\" at compile time, or that all the satellite assemblies required are loadable and fully signed."
Source="Probate"
StackTrace:
at Probate.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 180

at Probate.My.MyProject.MyForms.get_frmHCPLogo()

at Probate.My.MyApplication.OnCreateMainForm() in C:\Documents and Settings\Lester\My Documents\Visual Studio 2005\Projects\Probate\Probate\My Project\Application.Designer.vb:line 35

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

at Probate.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 76

at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()
I've been trying to figure this out for a day and a half now, and I am not getting anywhere. Any help would be appreciated.

lkinney at 2007-8-21 > top of Msdn Tech,Visual Basic,Visual Basic General...