Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer control not working

Status
Not open for further replies.

bclt

Programmer
Mar 13, 2005
363
GR
I have this simple code:

Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Button1.Text = "errrr"
End Sub


Interval: not 0
Enabled: true

? See any error ?
TnX.
 
what do you want to do when the timer elapses?

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
change a button's caption (text). This simple thing is for checking that it works,.....but not
 
Well, this i want to de done every 1 minute is to reload (refresh) the aspx web form.

Could this be achived? Timer not seem to work.
 
The aspx server code only runs once each time the page is requested from the server. Your confusing Windows Forms with Web Forms.

This will refresh a web page.
The meta tag belongs within the <head> of your HTML document.
<meta http-equiv="refresh" content="600">



Keeping it Real, Simple!
 
I'll try this.

But what is the use of this timer contol?
I'd like to work; my plan is to have a label on the web form with text "60", after one second "59", 58" etc.
When the text is "0" (elapsed one minute), want to refresh the page.

Tnx anyway
 
In that case use javascript

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
ca8msm is right, either that or html. We had a discussion on this topic at some length here at tek-tips a few months ago. The take home message appeared to be to just avoid it - perhaps it will be upgraded in later versions -- but no one in that discussion supported its current use as you are suggesting - unless it is further supported in the latest version of .NET.
 
<input type=text id=text1>
<script>
var counter = 60;
window.setInterval("DoIt()",1000);
function DoIt(){
if(!document.getElementById())return;
if(!document.getElementById("text1"))return;
text1.value = counter
counter = counter - 1;
if(counter<0)document.location.reload();
}//end function
</script>




Keeping it Real, Simple!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top