Solved

The process cannot access the file "EVSET2BC7601F642B1175BD6C0A956232F5CF.xml" because it is being used by another process.

Posted on 2006-07-08
2
877 Views
Last Modified: 2012-06-27
I'm getting this exception thrown when I run one of my threads.

EXCEPTION GETEPP: The process cannot access the file "C:\EVENTSETTINGS\EVSET2BC7601F642B1175BD6C0A956232F5CF.xml" because it is being used by another process.

How would i implement a stream to write the xml, if thats the solution.

Here is the code where the problem occurs,




            Dim TEMPPATH As String = "C:\EVENTSETTINGS\EVSET" & EVI & ".xml"

            Dim CompleteTable As New DataSet
            Dim TBLCOPY As New DataTable

            TBLCOPY = TBL.Copy
            CompleteTable.Tables.Clear()
            CompleteTable.Tables.Add(TBLCOPY)

         

            Try
                CompleteTable.WriteXml(TEMPPATH)
                CompleteTable.Tables.Clear()
                CompleteTable.Dispose()

            Catch ex As Exception
                Do While Not ex.Message.ToString = ""
                    Debug.Write("EXCEPTION GETEPP: " & ex.Message.ToString & vbNewLine)
                    Thread.Sleep(1)
                Loop
            End Try


            Debug.Write(vbNewLine & "WRITING FILE: " & TEMPPATH & " TABLE COUNT: " & CompleteTable.Tables.Count & vbNewLine)

            strTag = ""



            MainForm.FieldParseControls(TEMPPATH, MainEventFormURL)



500 Points because this is urgent! :D

0
Comment
Question by:JPERKS1985
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 17067177
Are there other threads/processes accessing this file?

This is just telling you that something else has it opened exclusively.

perhaps you are missing a clsoe or dispose somewhere else?
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 17069425
I fixed it by removing a thread that was writing to it. I have more code that has the same issue though. any suggestions?




        Dim DSet As New DataSet
        Dim Dtbl As New DataTable
        Dim flXML As String



        flXML = (TabControl1.SelectedTab.Tag)


        DSet.ReadXml(flXML)


        Do While DSet.Tables.Count = 0
            Application.DoEvents()
        Loop



        Dim cName As ComboBox = CType(sender, System.Windows.Forms.ComboBox)
        cName.Name = CType(sender, System.Windows.Forms.ComboBox).Name

        Dim DRow As DataRow
        Dim EventFileName As String

        For Each DRow In DSet.Tables(0).Rows
            If IsDBNull(DRow.Item("VALUE")) Then
                DRow.Item("VALUE") = "NULL"
            End If
        Next

        For Each DRow In DSet.Tables(0).Rows

            If DRow.Item("VALUE") = cName.Name Then
                DRow.Item(8) = cName.Text
                TMEventInfoParseGrid.DataSource = DSet
            End If
        Next

   
        DSet.WriteXml(flXML)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question