Results 1 to 4 of 4

Thread: saving and opening every x seconds

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    UK
    Posts
    201

    saving and opening every x seconds

    how can i make a file open every, x seconds, and save every x seconds?

    this is for a chat room for the network

    the chat room needs to be upto date, when a user enters a message, so it needs to refresh the page, automaticly, every so many seconds

    the chat room needs to be upto date, when a user enters the message and the file will need to save, every x seconds, so new users can see

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: saving and opening every x seconds

    You could put your save routine in a timer that is set to fire every x amount of seconds.

    My questions are:

    What are you saving?
    In what format do you wish to save it?
    Where are you saving it?

    I don't get what you mean by "Open". It is already open, you are just saving what is there.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    UK
    Posts
    201

    Re: saving and opening every x seconds

    ok, its a chat room, where the chat log is saved in a text file.

    the file is being opened by this

    VB Code:
    1. Dim F As Integer
    2. Dim LineFromFile
    3. F = FreeFile
    4. LstTextFile.Clear
    5. 'location of text file
    6. Open App.Path & "/chatlog.txt" For Input As #F
    7.     Do While Not EOF(F)
    8.         Line Input #F, LineFromFile
    9.         LstTextFile.AddItem (LineFromFile)
    10.     Loop
    11.  
    12.  
    13. Close #F

    it will need to be saved in the same place, using a timer, not sure on the code
    it will also need to refresh/reopen, so users can see what is being said in the chat room

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: saving and opening every x seconds

    Here is how to save it
    VB Code:
    1. Private Sub Command1_Click()
    2. Open App.Path & "\chatlog.txt"" For Append As #1
    3. Print #1, Text1.Text
    4. Close #1
    5. End Sub
    I still don't see why the refreshing is all about. All you have to do is keep scrolling to the bottom of the textbox and everyone will be able to see what has been said.

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