?
Solved

I have a lightswitch screen and want to change a number of labels if the date changes.  How do I test if screen is initialized?

Posted on 2014-12-14
3
Medium Priority
?
96 Views
Last Modified: 2014-12-19
I don't want the this.FindControl("RoomBookings").ControlAvailable += ChangeHeader; when the form hasn't been initialized yet.

        partial void ParameterFromDate_Changed()
        {
           
            if ({Need a test here to make sure the form has been initialized first.  Causes error since form isn't setup yet})
            {
                this.FindControl("RoomBookings").ControlAvailable += ChangeHeader;
            }
        }
0
Comment
Question by:Peter H.
  • 2
3 Comments
 
LVL 15

Expert Comment

by:ChloesDad
ID: 40499376
Why not put a timer control on the form. Then the timer_elapsed event will only fire if the form is in memory so you wont need to check if the form is in memory.

You can then trigger the timer every few seconds, and check if the date is different from the last time the event fired using a private variable in the form. When you do see a change you can change the labels as required.
0
 

Accepted Solution

by:
Peter H. earned 0 total points
ID: 40499383
Actually I just solved it a few min ago.  

Added a property
public Boolean FirstTime = true;

        partial void ParameterFromDate_Changed()
        {
           
            if (this.FirstTime == false )
            {
                this.FindControl("Bookings").ControlAvailable += ChangeHeader;
            }
            this.FirstTime = false;
0
 

Author Closing Comment

by:Peter H.
ID: 40508797
Found a workaround that worked.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question