• 0

The process cannot access the file



Here is my VB.net 2010 code when a cell in a datagrid is clicked strPath being set to the full path of the file 


                Dim fs As New FileStream(strPath, FileMode.Create, FileAccess.Write) 
                k = UBound(myData)
                If k > 0 Then
                    fs.Write(myData, 0, k)
                    picImage.SizeMode = PictureBoxSizeMode.Zoom
                End If


The next time the code is accessed, ie  a cell in the datagrid is clicked I get a "The process cannot access the file" error




Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

If I remember correctly, PictureBox.Load will lock the file. Your best best is to load an Image object from the file and set the PictureBox.Image property.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.