473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Timer does not count when in a IF statement

In my program I have an If statement, where I check if a file exist.

check:
Expand|Select|Wrap|Line Numbers
  1.         If FileFolderExists(FGH2) Then
  2.             TextBox6.Text = TextBox3.Text
  3.         Else
  4.             GoTo check
  5.         End If
  6.  
  7.  
  8. I have a timer counting how many seconds it takes before my file is visible (created)
  9.  
  10.  Public Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  11.         TextBox3.Text = TextBox3.Text + 1
  12.     End Sub
But when my prgram is in the If statement it does not count the passed seconds.
Any tips why this happens.
Jan 3 '15 #1

✓ answered by Rabbit

The reason it's not ticking is because code doesn't run while other code is running unless you tell it to.

Also, ticks are not accurate. Instead, store the start time and compare it with the current time.

3 1290
Luuk
1,047 Expert 1GB
It looks like you need DoEvents
Jan 3 '15 #2
Luuk
1,047 Expert 1GB
oops, for the DoEvents, I have the wrong link
I meant this one:
http://msdn.microsoft.com/en-us/libr...vs.110%29.aspx
Jan 3 '15 #3
Rabbit
12,516 Expert Mod 8TB
The reason it's not ticking is because code doesn't run while other code is running unless you tell it to.

Also, ticks are not accurate. Instead, store the start time and compare it with the current time.
Jan 3 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sincethe2004 | last post by:
I have a C# source code need to share between different programs, does C# have statement like include in C?
1
by: Ethan Strauss | last post by:
Hi, I have a C#.net Web application which calls a web service (http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl). It has run just fine for months. Recently I started getting...
8
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
5
by: jitendra_jkr_mca05 | last post by:
hi, I am developing a window application using c#.net. In the main MDI Form i used a timer, and in timer's tick event i have done some neccessary work. In this form I also used notifyicon to...
2
by: =?Utf-8?B?U3VyZXNoIFJlZGR5?= | last post by:
I am getting a strange problem with IE7 tabs. The web application I am working (developed in ASP.Net, .Net 2.0), will show a popup message with the count down timer 2 minutes before session time...
1
by: RaviRajhulk | last post by:
If there is a code like SELECT count(1) from TABLE Where condition1=condition2; Is count(1) same as count(*)? Does count(1) counts the first column of the table?
8
by: Rainer Queck | last post by:
Hello NG, in my application I have a Panel, docked right to my Form. On this panel I draw - cyclic triggered by a System.Winforms.Timer - a bitmap using the Graphics class. using (Graphics g =...
1
by: RiddleMeThis | last post by:
In Crystal, I've come across the following code but don't really understand it: COUNT ({tableName1.column1},{tableName1.column1}) I'm involved in creating equivalent reports from an old system...
1
by: Charles Ndethi | last post by:
Hi I want to set the session id to a value after evaluating the request_time using a case when statement. here 's the table userinput_id session_id request_time ...
1
by: mensajero | last post by:
Hi, I'm just a user and I had this query programmed by a friend and seems to have stop working. The error message I get says that the error is near the CASE WHEN statement at line 8. Any comments...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.