Last post Jan 21, 2017 01:04 PM by PatriceSc
Jan 14, 2017 07:33 AM|SANJISH KUMAR|LINK
I have use a variable assvar_flag and used it like
in initform method the value of variable assvar_flag is "" even though it should be "Y"
Jan 14, 2017 07:51 PM|PatriceSc|LINK
You likely defined a local assvar_flag variable inside the initform() function.
Jan 15, 2017 04:22 PM|SANJISH KUMAR|LINK
I have defined it as a public variable outside of initform()
Jan 16, 2017 01:03 AM|oned_gk|LINK
Try use Shared
Shared assvar_flag As String = "Y"
Jan 16, 2017 08:23 AM|PatriceSc|LINK
But is it defined ONLY here? Did you check if you don't use the same name as a local variable? What is the value immediately just before leaving InitForm and just after the InitForm call? If not the same you necessarily use two distinct variables.
I wouldn't use Shared as it would be then a single value for all users (if already the case it could cause this issue, does it always happen or sometimes only ?)
Make sure also that InitForm doesn't call something that just reset again this same variable.
Jan 17, 2017 02:45 AM|SANJISH KUMAR|LINK
I finally made it work
Jan 21, 2017 05:03 AM|Cathy Zou|LINK
Hi SANJISH KUMAR,
Congratulations and thanks for your sharing.
Jan 21, 2017 01:04 PM|PatriceSc|LINK
Good but whenever possible it's best to fix th source issue rather than to add some code to mitigate the problem you are seeing. Adding doevents seems to pojnt at some kind of event ordering problem that changes this global value making the value wrong if
they don't happen in the proper order or when you think.
Also it seems a Windows app for which you'll find forums at https//msdn.microsoft.com/