Refresh label.text in Form_Load

jdy0803

Member
Joined
May 20, 2013
Messages
17
Programming Experience
10+
I made some call in the Form_Load and terminate like this.

C#:
        private void Form1_Load(object sender, EventArgs e)
        {
            Label1.Text = "Prepareing...";
            
            SetGain("3");
            SetIntegrationTime("500");
            SetThresholdLevel("50");
            SetTimeOut("20");


            Label1.Text = "Ready!";


            ImageAcquireProc();//wait for user triggering
            this.Close();
        }
ImageAcquireProc wait for some triggering by user.
Therefore, Form should be displayed.
However program terminate after triggering without Form display.
How to make Form is displayed?
 
The Load event handler is raised BEFORE the form is displayed. The form will not be displayed until that event handler completes. At the very least, you should be handling the Shown event, which is raised AFTER the form is displayed. I think that there's more issues than that though. What exactly does that ImageAcquireProc method do?
 
In ImageAcquireProc, wait for X-ray detection and acquire data as soon as X-ray exposure is detected.
I tried backgroundWorker. I moved all codes in Form_Load to backgroundWorker_DoWork, I'm not sure if this is good way though.
 
I think that a full and clear description of what you're actually trying to achieve is in order, although the first post probably would have been the best place to provide it. It seems to me that what you want is to display the form and have it wait until it detects something, then it will acquire an image and then close. In that case you are almost certainly doing it all wrong, but to determine what you actually need to do, we need a proper description. What exactly is this "x-ray detection" and how does it work? Does the user have to press a Button or does the application detect the presence of a new file or does it receive input from some hardware or something else? We can't read your mind so you have to provide this relevant information for us.
 
Back
Top Bottom