Re: Some simple questions
I assume you're increasing the ProgressBar's value in another way, yes?
Either way, in the Timer's Tick event, you can check if the Value of the ProgressBar is 1000.
vb Code:
If ProgressBar1.Value = 1000 Then
MessageBox.Show("Success")
End If
You could then set an integer variable at class scope that will keep track of the seconds.
vb Code:
Dim _TimePassed As Integer = 0
If your timer is set to 1000 (1 second), each tick will be 1 second. Then, in the same event, at the top of it, you could add:
That way, each second, it gets + 1. Then check within the code:
vb Code:
If ProgressBar1.Value = 1000 Or _TimePassed = 10 Then
MessageBox.Show("Success")
End If
Re: Some simple questions
Quote:
Originally Posted by
weirddemon
I assume you're increasing the ProgressBar's value in another way, yes?
Either way, in the Timer's Tick event, you can check if the Value of the ProgressBar is 1000.
vb Code:
If ProgressBar1.Value = 1000 Then
MessageBox.Show("Success")
End If
You could then set an integer variable at class scope that will keep track of the seconds.
vb Code:
Dim _TimePassed As Integer = 0
If your timer is set to 1000 (1 second), each tick will be 1 second. Then, in the same event, at the top of it, you could add:
That way, each second, it gets + 1. Then check within the code:
vb Code:
If ProgressBar1.Value = 1000 Or _TimePassed = 10 Then
MessageBox.Show("Success")
End If
Yeah, that's what I was looking for. Thanks. Any clues on how to do the second thing I asked?
Re: Some simple questions
You can use a streamreader to read the file into a string variable then use Contains method to look for the search string.
Re: Some simple questions
Quote:
Yeah, that's what I was looking for. Thanks. Any clues on how to do the second thing I asked?
The second thing wasn't there originally ;)
But Gary's idea should work :D
Re: Some simple questions
Quote:
Originally Posted by
weirddemon
The second thing wasn't there originally ;)
But Gary's idea should work :D
You mean because I edited my post?
Lol, I just edited it to correct some grammar but the question was always there.
Re: Some simple questions
So to search for a string (TextBox1.Text) in a file i thought of this:
Code:
Dim readFile As System.IO.StreamReader
readFile = _
My.Computer.FileSystem.OpenTextFileReader("<File Directory>")
Dim fileString As String
fileString = fileReader.ReadLine()
But where should the TextBox1.Text go in that code?
Re: Some simple questions
Well that's a good snippet u found there but is only going to read a file loaded,
check this out. It should help you understant streamreader class a lil better.
And fyi, it sounds like you might want to look at some of the msdn tutorials on building forms in visual studio. Just a suggestion, no offesnse ment, by all means, knowledge is always only a question away.
Once you understand how the class actually works, u'll better understand on how to change out the variables.
and if i'm not mistakin, i'll have to look, i think there is actually a textreader subclass just for reading textbox strins n such
Re: Some simple questions
I cant find a textreader class, and i think streamreader wrong way to go because it actually reads from memory (ie you would need to save your textbox to a file then recall it)
why wouldn't textbox.text.contains work?
I think what your asking for initially is regular expressions which is a pain but u can get more info here
http://regexlib.com/