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.InvalidOperationExc eption 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.Permissio ns.FileIOP ermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193 4e089' failed."
Source="WindowsApplication 1"
StackTrace:
at WindowsApplication1.My.MyP roject.MyF orms.Creat e__Instanc e__[T](T Instance)
at WindowsApplication1.My.MyP roject.MyF orms.get_F orm1()
at WindowsApplication1.My.MyA pplication .OnCreateM ainForm()
at Microsoft.VisualBasic.Appl icationSer vices.Wind owsFormsAp plicationB ase.OnRun( )
at Microsoft.VisualBasic.Appl icationSer vices.Wind owsFormsAp plicationB ase.DoAppl icationMod el()
at Microsoft.VisualBasic.Appl icationSer vices.Wind owsFormsAp plicationB ase.Run(St ring[] commandLine)
at WindowsApplication1.My.MyA pplication .Main(Stri ng[] Args)
at System.AppDomain.nExecuteA ssembly(As sembly assembly, String[] args)
at System.AppDomain.ExecuteAs sembly(Str ing assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.Hos tingProces s.HostProc .RunUsersA ssembly()
at System.Threading.ThreadHel per.Thread Start_Cont ext(Object state)
at System.Threading.Execution Context.ru nTryCode(O bject userData)
at System.Runtime.CompilerSer vices.Runt imeHelpers .ExecuteCo deWithGuar anteedClea nup(TryCod e code, CleanupCode backoutCode, Object userData)
at System.Threading.Execution Context.Ru nInternal( ExecutionC ontext executionContext, ContextCallback callback, Object state)
at System.Threading.Execution Context.Ru n(Executio nContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHel per.Thread Start()
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.InvalidOperationExc
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Request for the permission of type 'System.Security.Permissio
Source="WindowsApplication
StackTrace:
at WindowsApplication1.My.MyP
at WindowsApplication1.My.MyP
at WindowsApplication1.My.MyA
at Microsoft.VisualBasic.Appl
at Microsoft.VisualBasic.Appl
at Microsoft.VisualBasic.Appl
at WindowsApplication1.My.MyA
at System.AppDomain.nExecuteA
at System.AppDomain.ExecuteAs
at Microsoft.VisualStudio.Hos
at System.Threading.ThreadHel
at System.Threading.Execution
at System.Runtime.CompilerSer
at System.Threading.Execution
at System.Threading.Execution
at System.Threading.ThreadHel
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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
I pasted the rest above.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.