Link to home
Start Free TrialLog in
Avatar of jackjohnson44
jackjohnson44

asked on

HELP strange error

I am making my first vb application.
I was trying to use a folder browser and was getting errors when using that path to open a file for writing.

I got rid of the code, and for some reason I can't run my application any more.

So now I have a form with a few buttons on it and almost no code after that.
I have one button event that definitely works.

I am getting this error

System.InvalidOperationException was unhandled
  Message="An error occurred creating the form. See Exception.InnerException for details.  The error is: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
  Source="WindowsApplication1"
  StackTrace:
       at WindowsApplication1.My.MyProject.MyForms.Create__Instance__[T](T Instance)
       at WindowsApplication1.My.MyProject.MyForms.get_Form1()
       at WindowsApplication1.My.MyApplication.OnCreateMainForm()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args)
       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.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
SOLUTION
Avatar of mbosch
mbosch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jackjohnson44
jackjohnson44

ASKER

I don't have any code, I even got rid of everything except

Public Class Form1
end class

I am not sure what is going on with the other files .net uses, but I didn't touch any of them.
I tried opening a dialog, adding "\test.txt", writing to it.
I was getting errors, so I got rid of everything and now I can't do anything.

Is there a way to figure out what lines are causing the problems?

I tried adding imports system.io on my form in various places, but got rid of it.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried putting it on my form above the class and below, but I took it out.
Like I said before, it is a blank form class with some buttons on it.

Basically I added a bunch of code to my form, then got rid of all of it.
I was trying to get rid of the problem by deleting all that I had added.

Again, the only file I touched was the form.

If something was added to designer.vb, I did not do it.


When I run the project, I get the error
"InvalidOperationException was unhandled"
I pasted the rest above.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just thinking...  but do you have any properties that are required to be initalized (buttons, labels, grids), say on a form load operation.  This might be a clue?  If you double click the form background you can find your form_load event.

Can you describe what your form does?

Lucas
To expand on what Kudzullc is saying you can also open up the designer.vb file and see if there is a block of code or a line referencing something that is no longer on your form.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial