Home All Groups Group Topic Archive Search About

Problem with OpenFile dialog

Author
27 Jun 2006 3:21 PM
Sean Campbell
Hi all!

I have a problem with the OpenFile dialog that I use in my program.

I created a Browse button to allow for the selection of a text file that is
processed by my program. The Browse button works perfectly when the .EXE is
on my station. If I copy the .EXE to a network drive, the Browse button stops
functioning. I have never seen this happen before.

I created my program with VB 2005. Is this a known problem or did I code
something wrong. Here is the code for my Browse button:


Private Sub btn_Browse_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_Browse.Click
        'Declare the local variables
        Dim ofd As New OpenFileDialog()
        FALPath = ""

        Try
            'Define the OpenFileDialog to obtain the raw FAL data
            ofd.InitialDirectory = "C:\"
            ofd.Filter = "fichiers fal (*.FAL)|*.FAL"
            ofd.FilterIndex = 1
            ofd.RestoreDirectory = True
            ofd.Multiselect = False

            If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
                FALPath = ofd.FileName
                txt_FALPath.Text = FALPath
            End if

        Catch ex As Exception
            'Insert the Exception Handling code
        End Try

    End Sub

I hope someone can enlighten me on this problem. Thanks.


Sean

Author
27 Jun 2006 6:53 PM
ronchese
What the error message?

And to you executable work in a network drive, you need to set special
permissions in "Manage Code Access Security Policy" in the .Net
Configuration (see on the Windows Control Panel > Administrative Tools)

[]s
Cesar


Show quoteHide quote
"Sean Campbell" <SeanCampb***@discussions.microsoft.com> wrote in message
news:4966E3FD-25CA-47F8-A918-054A1909774E@microsoft.com...
> Hi all!
>
> I have a problem with the OpenFile dialog that I use in my program.
>
> I created a Browse button to allow for the selection of a text file that
> is
> processed by my program. The Browse button works perfectly when the .EXE
> is
> on my station. If I copy the .EXE to a network drive, the Browse button
> stops
> functioning. I have never seen this happen before.
>
> I created my program with VB 2005. Is this a known problem or did I code
> something wrong. Here is the code for my Browse button:
>
>
> Private Sub btn_Browse_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btn_Browse.Click
>        'Declare the local variables
>        Dim ofd As New OpenFileDialog()
>        FALPath = ""
>
>        Try
>            'Define the OpenFileDialog to obtain the raw FAL data
>            ofd.InitialDirectory = "C:\"
>            ofd.Filter = "fichiers fal (*.FAL)|*.FAL"
>            ofd.FilterIndex = 1
>            ofd.RestoreDirectory = True
>            ofd.Multiselect = False
>
>            If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
>                FALPath = ofd.FileName
>                txt_FALPath.Text = FALPath
>            End if
>
>        Catch ex As Exception
>            'Insert the Exception Handling code
>        End Try
>
>    End Sub
>
> I hope someone can enlighten me on this problem. Thanks.
>
>
> Sean
>