Chaim
Dave's code does work correctly. Try it again in an even more simple format below. I have removed your cursor code and put in a wait state. I have also changed the message to your preference. The principle is correctly the subtraction of a start datetime() from an end datetime():
lnStart = datetime()
=inkey(2)
lnElapsed = datetime() - lnStart
lcElapsed = ttoc( {^2001-1-1} + lnElapsed, 2 )
Messagebox( "Your operation done in " + lcElapsed + " seconds!" )
Update: Using VFP7.
>Sorry,
>I want to get a messgebox for example: 'Your operation done in 147 seconds!'.
>Please run your following code, and you will not get the time elapsed only other thing
>Here is your code:
>lnStart = datetime()
>create cursor test (id i)
>for i =1 to 700000
>insert into test value (i)
>endfor
>lnElapsed = datetime() - lnStart
>lcElapsed = ttoc( {^2001-1-1} + lnElapsed, 2 )
>Messagebox( "Elapsed time:" + lcElapsed)
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.