By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Disappearing buttons

P: n/a
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

Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.
--
Klaus H. Probst, MVP
http://www.simulplex.net/
<ti*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 16 '05 #2

P: n/a
Thanks Klaus!
it all works fine now

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.