Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

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

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);
        }
    }

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc