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
76 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
Comment Utility
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
Comment Utility
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.
Comment Utility
Found a workaround that worked.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now