This is a cry for help.
I have spent many hours working on a program and today it just didn't load up in VS properly.
As far as I can see the designer file for the project just doesn't work.
The problem is I have added various buttons and controls to a windows form and all the controls are showing an error. Shown Below are some of the errors.
Error BC30451 'NotifyIcon1' is not declared. It may be inaccessible due to its protection level.
Error BC30451 'ToolStripPref270Degrees' is not declared. It may be inaccessible due to its protection level.
Error BC30456 'Show' is not a member of 'Main'.
Error BC30451 'ListBox1' is not declared. It may be inaccessible due to its protection level.
Error BC30451 'ListBox2' is not declared. It may be inaccessible due to its protection level.
Error BC30456 'Hide' is not a member of 'Main'.
Error BC30590 Event 'Load' cannot be found.
I have tried what most posts I can find are saying how to fix this but nothing is working.
looking in other designer files it seems totally different from what this designer file looks like. Other files have lots of text about the controls but this one has everything saying locked after the control. like below.
Public Shared ReadOnly Property Button1_Locked() As Boolean
Get
Dim obj As Object = ResourceManager.GetObject("Button1.Locked", resourceCulture)
Return CType(obj,Boolean)
End Get
End Property
it's took me an age to get this program working and i feel like trashing my pc after this. i've been trying to fix it since 5 hours at least. I read that if you delete the designer file, vs will regenerate one but that's just not happening. when i load the solution the designer window just doesn't load and i cant see any option to get it to load anywhere like some posts i've read are saying. Stopping short of just starting again, I come here look for help.
My question is how do you regenerate or fix a corrupt designer file in Visual Studio 2022 ?
Thanks for any help anyone can give.
edit:
The designer could not be shown for this file because none of the classes within it can be designed.
at Microsoft.DotNet.DesignTools.Client.CodeDom.CodeDomManager.GetDeclarations()
at Microsoft.DotNet.DesignTools.Client.Loader.VsDesignerLoader.PerformServerLoad()
at Microsoft.DotNet.DesignTools.Client.Loader.VsDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
After figuring out how to replace the broken designer.vb file with a blank one that allows the designer to load, I get these errors above when trying to save the file.
again thanks for any help anyone can give.
Related
I have a form with a button which opens a new form to add a new record to a table.
In Access on my PC (full version), everything works.
When I try to run it on a server with Access Runtime, I get an error saying something like:
this application has stopped working due to a runtime-error. The
application will now be closed
(I have the Dutch version, so I hope this comes close to the English dialog box message).
I debugged the VBA, but that doesn't seem to be the problem.
It has worked before:
Private Sub Knop62_Click()
DoCmd.OpenForm "Machines Toevoegen", , , , acFormAdd, _
acDialog, OpenArgs:=Me.Installaties_Id
End Sub
Well any un-handled error in the runtime will spit out the error message, and then as you experienced exit the application.
there are a good number of ways to approach this:
Improve error handling - make sure you don't encounter any un-handled error. I find this can be a LOT of work.
Another way? Compile your application down to a accDE. When you use a accDE, not only does the runtime ignore errors, not only does it NOT shut down?
It also means that all of your local and global variables are NEVER re-set. so global vars, and even global reocrdsets or anything else will retain their values, and do so even with errors. As a result:
Your application runs like a un-stoppable fright train.
Your local and even global variables retain their values. This allows use of application wide settings and variables that never re-set. And no re-sets ever occur even for un-handled errors. They remain intact for the given session (since the time the application was launched).
So, I would try running your application as a accDE on that server. It will not only become vastly more reliable, but it will also not shutdown on un-expected errors and even better it will retain the value of variables even when having encountered errors.
So it looks like you have some un-handed error. You can go on a treasure hunt to find this error, or just try a accDE in the meantime, and perhaps in the new years you might eventually track down the error or issue. But until then, just compile your application as a accDE.
To compile:
First, from VBA editor (just hit ctrl-g). And from the menu bar choose debug->compile. You MUST ensure that no compile errors exist before the next step.
If above compiles, then from UI (main ribbon), go file->Save and publish
From that panel, choose Make ACCDE.
Access will compile your application into a "access executable". Now try running this application with a accDE file extension on the other computer.
I randomly get an error saying HasFile is not a member of FileUpolad.
I'm using a file upload button to upload images to a server. This usually runs; however, every once in a while it errors out. Sometimes the error is caught by Visual Studio during run time, other times it will be a Server Error in Application. Compilation Error when I load the page in debug mode. I've check dependencies and everything seems to be fine. Even the IntelliSense brings up HasFile with I am writing the code.
Usually re-writing the line or restarting Visual Studio resolves the issue, but it keeps coming up randomly.
I happened to figure out what the problem was. Since it was my first time doing this I had a test class in the solution. The test class was named FileUpload. Rookie mistake. I can't believe I didn't catch that earlier!
When i run one of my vb project i get below warning message.
DisconnectedContext was detected
Message: Context 0x21b448' is disconnected. Releasing the interfaces from the current context (context 0x21b2d8).This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the applicationis completely done with the RuntimeCallableWrappers that represent COM components that liveinside them.
A quick google search gave me result like it can be solved by disabling the exception "disconnectedContext ". So I did in menu->debug->exception, under manage debug assistants deselect disconnectedContext and it solved the problem too.
But this setting is not project wise or visual studio wise. I found like this setting is saved in .suo file.Now I want this setting I made to be available for all users using the project. So how it can be set project wise so that all users using the project will be able to get disconnectedContext setting disabled
I have a Word Template with VBA.
Wherever I need to I handle my errors with either a "On Error Resume Next / On Error Goto 0" round a call to a collection that might fail, say, or a full error handler (On Error Goto label: / Resume exit_label:)
Tools Options is set to Break on Unhandled Errors
I have found that for this template (only it seems) that unhandled errors are not being reported. The VBA code just stops running without telling the user anything.
I have tried exporting all VBA modules / forms, saving the template as a .dotx, closing and reopening then saving as a .dotm again and adding the code back but same problem persists.
Other templates for this client work fine. A deliberately added delete for a non-existent bookmark causes an error to be shown. The same delete call is ignored by the iffy template BUT the code stops running so it isn't doing Resume Next.
If I add a full error handler to the procedure concerned it does error and reports via my msgbox code.
In some respects this wouldn't matter, anywhere I am expecting errors to be a possibility I handle them but I have a certain amount of code that deals with images in headers and they are prone to errors. At this point I want the code to error where they happen so I can analyse how to get around the error, just telling the user isn't going to get the template working. What I have at the moment is the code "dying" and it is very hard to track where without putting in loads of debug statements and seeing where they stopped.
Has anyone seen something like this before? Could I have set something for this template specifically to tell it to not error on unhandled errors?
Other templates on the same machine error quite happily.
The template is very complex so I don't have the option to make it from scratch. Turfing out the VBA and putting it back didn't fix it. If I have to I can add handlers for all procedures but that shouldn't be necessary as errors won't happen once I have tightened up the code.
Any help really appreciated - for a few days I thought it was just VBA dying when working with images, now I really it is something more general than that.
Ok. I have found the source of the problem.
I had used a couple of standard procedures we have in various projects for conveying busy/not busy to the user - we call them InterfaceOn and InterfaceOff. They change the cursor, switch off screen updating, etc.
One line for the Off proc is "Application.EnableCancelKey = wdCancelDisabled".
I hadn't realised how severe that line is, it appears to stop the errors being reported and the code just dies. The help for it warns it is risky but doesn't explicitly state that it'll kill VBA on an unhandled error.
The InterfaceOn procedure has the line that reverses the EnableCancelKey restriction.
These procedures are used a lot so I am surprised this issue hasn't shown up before. Have removed the EnableCancelKey lines for now. No particular need to be that dramatic with this project.
I recently reset my whole laptop. After the reset, I installed all of my programmes, including Visual Studio 2013 (I had 2012 on my last build). I then dumped my projects into the projects folder of 2013 and...I COULDN'T RUN MY PROJECT!!! I can view the code and the designer but I can't run it.
The error is from Application.Designer.vb and it is a "System.InvalidOperationException" error. Under additional information, it says "An error occured creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. Highlighted is Me.MainForm = Global.MyApplicationName.Form1
I have checked msdn for answers about System.InvalidOperationException but haven't found any fixes that work.
I really don't know what to do and don't want to lose my application as I've spent a fair bit of time on it.
I have 2 suggestions to try
Open Application.Designer.vb and just delete the word Global.
Exclude (not delete) the mainform (Form1, apparently) from the project. Save it. Then include it again and go to Project Properties and make it the startup form again.
I've had similar issues (without the exception) when reorganizing pieces of large solutions into other namespaces. Often, I need to drill into the designers to change a ref to get it to run and it is usually removing 'Global' and/or adding the new Namespace ref. In your case, it sounds like a similar reference in the project did not get updated from 2012.
If that is the case, the second way should get VS to write back all the files in a manner that it likes.