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
87 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.
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

737 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