Text File Refresh

CarcaBot

Well-known member
Joined
Apr 23, 2007
Messages
47
Location
Romania
Programming Experience
Beginner
Hy all,
i wanna refresh a text file on each 5 seconds for example.
how i can ?

and how i can set at startup a application ?

thx in advance.
 
dunno what's the regex pattern, i took this code from this forum i think.
but { str += " * " & s } explode the space between texts with *.
 
It appears you read a textfile, split lines, then create a string (str), and you do this in Timer.Tick event. Now what do you want to do with the string? Display it in a label? (Label1.Text = str)
 
no, i don't create a string , the string (str) is already created before .
Dim str As String
g.DrawString(str, fo, Brushes.White, widthX, heightY)


where str is the string which must appear on the form.
when i reading a file , i just add the text in str (+=)
 
So 'g' is a graphics instance? Where is this code used? If you think we're mindreaders you are crazy.

Also if you want to "refresh" the string you must clear it (str="") before you set new text, what you are doing now is keep on appending appending appending every timer event.
 
Yea, the g is a graphics instance { Dim g As Graphics }.

but the code must repeat itself continously

JohnH , look at my source code.
 

Attachments

  • NewsTicker.zip
    138.5 KB · Views: 24
Last edited:
Move the graphics stuff into Form1 Paint event, there you draw with e.Graphics.Draw... (not your creategraphics). In Timer1 Tick event you call Me.Refresh() that will cause the Paint event to update the painting.

There is also one other problem, first thing you do is to start Timer, which in turn call for reading files which path is retrieved in Settings, but when Settings is empty you will get ArgumentException because StreamReader is attempted created by empty string path "". You have to figure out a way to prevent this problem, check values before trying files or starting Timer.

And as I said, you must clear the 'str' before you update it with info from all the files all over again.
 
i did it almost as u said.. but it still didn't work remember i'm begginer :D

I too, usually find that doing things "almost like" what John says, means that they "almost work". Funnily enough, when I do things exactly like he says, then they exactly work :) remember, he's the expert ;)
 
Back
Top