?
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
?
93 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

777 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