Click here to Skip to main content
13,046,726 members (60,855 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i am asking a question please help me.
how can i change state of a button button_click to button_clicked.
i want exactly that if i hit submit button once then it moves to disable state and not work until i hit the cancel button or text changed in textbox.
i hope you understand the problem.
Thanx to all of you.
Posted 27-Mar-13 11:26am
joshrduncan2012 27-Mar-13 17:28pm
Are you referring to buttons being enabled or disabled? You may want to look at the enabled api of button controls.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The easy way is not to look at trying to change it to "clicked", but to disabled, or"greyed" instead.
That is easy: set the Button.Enabled property to "false" to disable it, and "true" to reenable it.

Handle the TextBox.TextChanged Event to reenable it.
Vijay Pareek 27-Mar-13 17:57pm
Thanx Dude...
Sergey Alexandrovich Kryukov 27-Mar-13 18:51pm
Sure, a 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Use WebControl.Enabled[^] property. All buttons properties are listed here:[^]

Button1.Enable = (TextBox1.Text.Length>0);

Windows.Controls.Button Class[^]
Windows.Controls.Button properties[^]
Vijay Pareek 27-Mar-13 17:57pm
Thank You..
Maciej Los 27-Mar-13 18:03pm
You're welcome ;)
By The Way, 3 stars means: fifty - fifty helpful.
Sergey Alexandrovich Kryukov 27-Mar-13 18:51pm
It really means down-voting. :-( I voted 5 to compensate; correct answer.
Maciej Los 28-Mar-13 2:38am
Thank you, Sergey ;)
Sergey Alexandrovich Kryukov 27-Mar-13 19:22pm
Oh, why System.Web.UI.WebControls? The question says "Windows forms"...
Also, it makes sens in TextChanged event handler...
Maciej Los 28-Mar-13 2:38am
Tag: ASP.NET :)
OP deserves 1... :-)
Maciej Los 28-Mar-13 3:38am
Answer updated, reference to Windows.Controls.Button added ;)
Sergey Alexandrovich Kryukov 28-Mar-13 10:18am
Fair enough...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100