OK, we don't know what language you are using, or even framework - let alone environment - so there are a massive number of possible answers to this, and we can't give you any "specific" solution. For example, a PHP/Javascript web based solution would be very different from a C# WinForms solution.
But we can kinda explain the basics.
Start with the timer: read the documentation for your language / framework / environment for "timers" and look at the code samples.
These may be a starting point:
JavaScript Timing Events[
^]
Timer Class (System.Timers) | Microsoft Docs[
^]
Then you need to do three things:
1) Validate and convert the textbox1 content to a double
2) Validate and convert the textbox2 content to a double
3) Subtract one from the other and put the result back into textbox1
Again, they may be a starting point:
JavaScript parseFloat() Function[
^]
Double.TryParse Method (System) | Microsoft Docs[
^]
Note that you can't convert textbox1 to an integer, as it will fail and ignore the fractional part of the textbox2 value anyway.