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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dlg As New SaveFileDialog
Dim res As DialogResult
res = dlg.ShowDialog()
If res = Windows.Forms.DialogResult.OK Then
MsgBox(dlg.FileName)
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.Security.SecurityException":
================================================== ======================
Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' 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.InitialDirectory = "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.