# Static in a window method

**URL:** <https://forum.xojo.com/t/static-in-a-window-method/13762>\
**Category:** General\
**Created:** [January 20, 2014, 3:28pm UTC](https://forum.xojo.com/t/static-in-a-window-method/13762 "2014-01-20T15:28:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramon\_SASTRE](https://forum.xojo.com/user_avatar/forum.xojo.com/ramon_sastre/32/326_2.png) [@Ramon\_SASTRE](https://forum.xojo.com/u/Ramon_SASTRE)\
**Post date:** [January 20, 2014, 3:28pm UTC](https://forum.xojo.com/t/static-in-a-window-method/13762/1 "2014-01-20T15:28:35Z")

</div>

I know that a variable declared with Static instead of Dim “retains its value from one invocation of the method to the next”, according to LR.  
But what happens if I close the window where the method belongs?  
When I reopen that window, will the Static variable value continue retained or will start from scratch?

---

<div class="post-metadata">

**Author:** ![Joe\_Ranieri](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@Joe\_Ranieri](https://forum.xojo.com/u/Joe_Ranieri)\
**Post date:** [January 20, 2014, 3:31pm UTC](https://forum.xojo.com/t/static-in-a-window-method/13762/2 "2014-01-20T15:31:38Z")

</div>

> [@60209:@Ramon SASTRE](#):
>
> When I reopen that window, will the Static variable value continue retained or will start from scratch?

Retained. It’s essentially a global variable but at local scope.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:02pm UTC](https://forum.xojo.com/t/static-in-a-window-method/13762/3 "2020-10-29T17:02:27Z")

</div>


