Results 1 to 3 of 3

Thread: [RESOLVED] File Sharing

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Resolved [RESOLVED] File Sharing

    Hi,

    Ok Should be last question for this project. I have Two exes that both read from the same text file and one of the exes writes to it. Also the EXE that reads from it will be on around 10 computers which will all read from the same exe, When I run if I hit it wrong I get an error saying the file is in use.

    How can I get it that the exes either ignor the erorr pass over it until the next timer tick (which is not that often)

    Or get it so the file can be shared?

    M.Carpenter

  2. #2
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: File Sharing

    Hi,

    You are not specifying VS version, or which command are you using to open files

    anyway I suggest you to open the file (on the thread that is writing) allowing other process to read the file

    VB Code:
    1. System.IO.FileStream("C:\yourfile", IO.FileMode.Open, IO.FileAccess.readwrite, IO.FileShare.Read)

    Hope this helps
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: File Sharing

    I am using vb .net 05 sorry keep forgetting

    and using streamread like:

    dim reader as new streamreader = _
    new streamreader (path)

    readlines

    finnaly reader.close

    but I have multiple streamreaders in the same timer so what I hcae done is the very first line of the timer is try

    then at the end of the timer

    catch
    timer1.stop
    errorcatcher()

    then error ctacher does some stuff then starts timer 1 again and it seems to be working

    but thanks anyway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width