473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Change visible state for a Button

Hello,

On a form, I place a buton with an OnClick event. No problem.

I set the visible propperty of this button to false.
And reset it so true again, the event isn't fired ans my app same to be
crashed ...

Any idea?

Thx
May 30 '07 #1
1 2984
Can you clarify?
On a form, I place a buton with an OnClick event.
Do you mean that you subscribe to the Click event?
the event isn't fired
Do you mean that subsequently clicking the Button has no effect?
my app same to be crashed ...
In what way?

What framework version? (1.1, 2.0?)

Are you doing anything unusual? threading?

The following works fine:

static void Main() {
using (Form f = new Form())
using (Button b1 = new Button())
using (Button b2 = new Button()) {
b1.Text = "Toggle visible";
b2.Text = "Click me";
b1.Click += delegate { b2.Visible = !b2.Visible; };
b2.Click += delegate { f.Text += " [click]"; };
b1.Dock = b2.Dock = DockStyle.Top;
f.Controls.AddRange(new Control[] {b2, b1});
Application.Run(f);
}
}

May 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mr. Smith | last post by:
Hi. I have a form with three <textarea> and one <input> element. When either of these are changed I want an "Update" button to be visible at the bottom of the form. I've tried this: On every...
0
by: Andy Eshtry | last post by:
I have a radio button list, a textbox representing SIN or EIN based on my radio button list selection so I put 2 regularexpressionvalidator to evaluate the value of textbox. EIN must be (for...
16
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
6
by: James Black | last post by:
'When my form is submitted, I have onsubmit pointed to the following code snippet. But, the button is not actually set to disabled and the style.visibility changes are not made for several...
5
by: perhapscwk | last post by:
I have something like below, normally when my mouse is over the button, it will change from less visible to visible, if mouse move away, it turn back to less visible. But now i want to make it...
3
by: Tetelestai | last post by:
I have a command button on a form that should be visible or not visible depending on a value in the current record and the current users user level. The code below is working as in the immediate...
8
by: Dan | last post by:
Hi, i experimented with postback and viewstate. With this code, there are 2 dropdownlists created, one visible and with AutoPostBack true, the other not visible and no AutoPostBack, and one...
3
by: GiJeet | last post by:
I put the the button property in the watch window but it doesn't stop when the property changes value. For example I put this.myButton.Visible in the watch window with an initial value of false...
2
by: bahnfire | last post by:
Hi, I am hoping that I finally have the right group :-) I am using Visual C++ Express 2008 and am trying to change the taskbar icon that I am using (notifyIcon1) as some state changes (button...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.