Click here to Skip to main content
15,917,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have windows (wordnet api) which is load in button click
C#
frmWordnetAPI relatedWords = new frmWordnetAPI();
relatedWords.ShowDialog();

This API is getting some data from (source file) directory. When compling the program in first button click the form is loading perfectly, but when I close API and re click the button to load it is throwing an exception saying that
The process cannot access the file 'D:\MIT\project\wordnet API\TestApplication\WNdb-3.0\dict\index.adj' because it is being used by another process.

The following code is throwing an exception
BinarySearchTextStream searchStream = new BinarySearchTextStream(indexPath, new BinarySearchTextStream.SearchComparisonDelegate(delegate(string searchWord, string currentLine)
{
    // if we landed on the header text, search further down
    if (currentLine[0] == ' ')
        return 1;
    string currentWord = currentLine.Substring(0, currentLine.IndexOf(' '));
    return searchWord.CompareTo(currentWord);
}));

Please help
Posted
Updated 20-Jun-10 13:37pm
v3

1 solution

Maybe you forgot to close the file (a thread might still be holding it open, and you didn't properly terminate the thread?).

Make sure your app isn't still running (use Task Manager).
 
Share this answer
 
v2
Comments
Kasunmit 20-Jun-10 12:25pm    
in task manager application it close as i close window ... may i upload the code block where the exception is pointing to u to get a idea ..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900