Disappearing buttons

  • Thread starter Thread starter timm.wong
  • Start date Start date
T

timm.wong

Hi,


I have a form where i have a thread working in the background that
tests a connection to a server. If the connection is not
successful,then I want it to display 2 buttons on the form. I have
tried doing this so far by simply setting the buttons Visible property
to true (since they will initially be invisible), but by doing so, the
buttons don't seem to appear. I have also tried using the Show()
method, which makes the buttons appear, but then the buttons do not
seem to function properly i.e. clicking on the buttons do not do
anything. Using the Focus() method following the Show() method doesn't
seem to work either.


If I don't use a thread to test the connection then evrything works
fine. But I need to use a thread so that the GUI can function whilst
the connection is being tested
If any1 has any ideas it would b greatly appreciated

Regards,
Tim
 
Use the control's Invoke method to set the property from the other thread.
Controls are not thread safe so they can't be accessed from any thread.
That's what the Invoke() function is for.

I don't know why they would be disappearing, but that's the first thing I'd
try.
 
Back
Top