hello I created a simple program that login then the program gets some data from a file. I logged in but then a error message pops out error cant read file cause it is used by another process. The weird thing is that it can be open in the notepad.

This is the log from Filemon:

16:39:29 media time cont:3836 OPEN C:\vb.net aps\****\data\alex\MaxTime.txt SUCCESS Options: Open Sequential Access: Read
16:39:29 media time cont:3836 OPEN C:\vb.net aps\****\data\alex\Time.txt SUCCESS Options: Open Sequential Access: Read
16:39:29 media time cont:3836 CREATE C:\vb.net aps\****\data\alex\Time.txt SHARING VIOLATION Options: OverwriteIf Sequential Access: 00120196
16:39:29 media time cont:3836 OPEN C:\vb.net aps\*****\data\alex\ SUCCESS Options: Open Directory Access: 00100000
16:39:29 media time cont:3836 OPEN C:\vb.net aps\*****\data\alex\ SUCCESS Options: Open Directory Access: 00100000
16:39:35 media time cont:3836 CLOSE C:\vb.net aps\****\data\alex\Time.txt SUCCESS
16:39:35 media time cont:3836 CLOSE C:\vb.net aps\time controller\data\alex\MaxTime.txt SUCCESS

here is a bit of the source code:

Dim c As New System.IO.StreamReader("C:\vb.net aps\*****\data\" + inlogged_to + "\Time.txt")

If f.ReadLine = DateTime.Now.ToString("dd/MM/yyyy") Then
            f.Close()
            time = c.ReadLine
            c.Close()

/Alex

Recommended Answers

All 2 Replies

>File used by another process

Use File.ReadAllText or File.ReadAllLines method. Can you maybe provide some more information about what it is you are trying to do?

>File used by another process

Use File.ReadAllText or File.ReadAllLines method. Can you maybe provide some more information about what it is you are trying to do?

I tried read to end but it did not work and File.ReadAllText() and File.ReadAllLines() is not a member of 'System.IO.StreamReader'.

as for information I can say that in the text file right now there is just one line
and it ill be a number from 0 to the in my case 3600 number

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.