Security Exception OpenFileDialog

  • Thread starter Thread starter Jiddu
  • Start date Start date
J

Jiddu

Hi Guys,

I'm using Visual C# express (beta) and I'm trying to acquire the
filename from the selected file in an OpenFileDialog box. Seems
pretty straight forward except every time I attempt to access the
FileName property I get a security exception. This also occurs when
I attempt to set the InitialDirectory property. I can set the
filters however.

Everything has been declared correctly.

Any ideas?
private void addSourceFileButton_Click(object sender, EventArgs e)
{
try
{
addSourceFileDialog.ShowDialog();
sourceFileListBox.Items.Add(addSourceFileDialog.FileName);
}
catch (SecurityException ex)
{
MessageBox.Show(ex.Message);
}

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
okay I've worked out that I get security exceptions pretty much
whenever I access anything.

It's related to Visual Studio so some settings in there must be off.
I can run the program outside of Visual Studio without any problems.

Could someone advise me on how to configure global security settings
within Visual C# express beta? I'm sure its the same as within other
versions, or I'll easily find it with a little information.

Thanks,
adam.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
Back
Top