Greetings
I'm new to both .NET and Visual Basic, but I've got experience of
developing Windows-application earlier (w/o .NET or any framework).
Consider this code:
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim dlg As New SaveFileDialog
Dim res As DialogResult
res = dlg.ShowDialog( )
If res = Windows.Forms.D ialogResult.OK Then
MsgBox(dlg.File Name)
End If
End Sub
The *only* thing I want from this function is the filename that filename
that the user picked inside the dialog.
However, I get an exception in mscorlib.dll of type
"System.Securit y.SecurityExcep tion":
=============== =============== =============== =============== ============
Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed.
=============== =============== =============== =============== ============
As a tip for troubleshooting , Visual Studio tells me to use the OpenFile
method to open or save a file. But this is not what I want, I want the
filename only.
Also, issuing something like dlg.InitialDire ctory = "T:\" throws the same
exception.
So, I'm running into these tedious problems that I'm unaware of why it's
happening. Visual Studio tells me some file is not trusted or whatever. I
certainly don't give a ditch, but I guess there's some for me unknown
reason for this.
I would be grateful if any could straighten it out and explain why it's
happening as it does.
Thanks.
--
Rikard.
I'm new to both .NET and Visual Basic, but I've got experience of
developing Windows-application earlier (w/o .NET or any framework).
Consider this code:
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim dlg As New SaveFileDialog
Dim res As DialogResult
res = dlg.ShowDialog( )
If res = Windows.Forms.D ialogResult.OK Then
MsgBox(dlg.File Name)
End If
End Sub
The *only* thing I want from this function is the filename that filename
that the user picked inside the dialog.
However, I get an exception in mscorlib.dll of type
"System.Securit y.SecurityExcep tion":
=============== =============== =============== =============== ============
Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed.
=============== =============== =============== =============== ============
As a tip for troubleshooting , Visual Studio tells me to use the OpenFile
method to open or save a file. But this is not what I want, I want the
filename only.
Also, issuing something like dlg.InitialDire ctory = "T:\" throws the same
exception.
So, I'm running into these tedious problems that I'm unaware of why it's
happening. Visual Studio tells me some file is not trusted or whatever. I
certainly don't give a ditch, but I guess there's some for me unknown
reason for this.
I would be grateful if any could straighten it out and explain why it's
happening as it does.
Thanks.
--
Rikard.
Comment