Need help me with about 5 lines of code 
Author Message
 Need help me with about 5 lines of code

Hi,
Can someone help me with about 5 lines of code ?
I am confused with the Timer, Interval, and related things.
I am sure I can find my way if I get a minimal program doing this:
- Make a loop from 1 to 100000
- After a 2000 ms delay, exit the loop and print "hello" on the screen
Thanks.
Tewfik



Sat, 02 Sep 2000 03:00:00 GMT  
 Need help me with about 5 lines of code

You don't need to create a loop to make this work with the Timer control.
Once the Timer is enabled, it starts counting.  If you have the Interval
property set to 2000, then the Timer event will fire every 2000ms until the
Timer is disabled.  Put your "hello" code in this event.

--
Scott Martin
Gecko Development
(remove "nospam-" in email replies)

Quote:

>Hi,
>Can someone help me with about 5 lines of code ?
>I am confused with the Timer, Interval, and related things.
>I am sure I can find my way if I get a minimal program doing this:
>- Make a loop from 1 to 100000
>- After a 2000 ms delay, exit the loop and print "hello" on the screen
>Thanks.
>Tewfik


begin 666 Scott Martin.vcf
M0D5'24XZ5D-!4D0-"DXZ36%R=&EN.U-C;W1T#0I&3CI38V]T="!-87)T:6X-
M"D]21SI'96-K;R!$979E;&]P;65N= T*5$E43$4Z4')E<VED96YT#0I.3U1%

M+R]H;VUE+F5A<G1H;&EN:RYN970O?F=E8VMO9&5V#0I54DPZ:'1T<#HO+VAO
M;64N96%R=&AL:6YK+FYE="]^9V5C:V]D978-"D5-04E,.U!2148[24Y415).
M150Z9V5C:V]D979 ;F]S<&%M+65A<G1H;&EN:RYN970-"D5.1#I60T%21 T*
`
end


Sat, 02 Sep 2000 03:00:00 GMT  
 Need help me with about 5 lines of code

    Dim TargetTime As Date
    TargetTime = DateAdd("s", 2, Now())
    Do
        If TargetTime <= Now() Then Exit Do
    Loop
    MsgBox "Hello!"

Hope this helps and...... sorry if are 6 lines.



Sat, 02 Sep 2000 03:00:00 GMT  
 Need help me with about 5 lines of code

I won't give you code, but the reasoning.  The timer is almost always misused at first
until you get the grasp of what it does .... and it does absolutely nothing until the
interval has *expired*, at which time its _Timer event fires once.  Therefore you code the
event to happen on reaction to a timed event in the timer sub.  The order of events is:
set the interval, enable the timer, when interval expires _timer event fires, set timer to
false (often in the timer event itself).

--

Randy Birch, MVP Visual Basic
VBnet, The Visual Basic Developers Resource Centre
http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm

:Hi,
:Can someone help me with about 5 lines of code ?
:I am confused with the Timer, Interval, and related things.
:I am sure I can find my way if I get a minimal program doing this:
:- Make a loop from 1 to 100000
:- After a 2000 ms delay, exit the loop and print "hello" on the screen
:Thanks.
:Tewfik

:



Sat, 02 Sep 2000 03:00:00 GMT  
 Need help me with about 5 lines of code

Quote:

> Hi,
> Can someone help me with about 5 lines of code ?
> I am confused with the Timer, Interval, and related things.
> I am sure I can find my way if I get a minimal program doing this:
> - Make a loop from 1 to 100000
> - After a 2000 ms delay, exit the loop and print "hello" on the screen

Hi,

1. Solution (without a timer)

  i=0
  t=timer
  do
   i=i+1
   'some code
  loop while i<100000 and timer-t<2

2. Solution

  sub doSomething
   timer1.interval=2000
   timer1.enabled=true  
   timer1.tag=""
   for i=1 to 100000
    'some code
    doevents
    if timer.tag<>"" then
     exit for
    endif
   next
  end sub

  sub timer_timer()
   timer1.tag="Stop"
   timer1.enabled=false
  end sub  

Hope this helps

Michaela



Sun, 03 Sep 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. HELP - Manually Place Long Lines of Code over Several Lines in Code Window

2. Need help with this Code...Expectes line number or end of statement

3. Need help with about 5 lines of code

4. help, help, help...I'm begging here :-\ RE RE POST simple code help needed

5. Assistance needed with line wrapping code. Many thanks

6. I need help Line number - help me...

7. Continuing a line of code on the next line

8. 1 line of code on 2 lines

9. How to execute script code line by line?

10. pls help me with this line of code

11. Please help - Lining code to Data control

12. Please Help-What's wrong with these two lines of code

 

 
Powered by phpBB® Forum Software