473,403 Members | 2,366 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,403 software developers and data experts.

C# Forms - Fire textbox event only from user interaction

Hey All,
I can't see to find a nice solution to this. I have a textbox, and a button. When the textbox text is set by the user, I want the button to enable. When the text is set through code (ie. textbox.Text = "Hi"), I don't want it to fire the event. Is there an event that I can use that will listen only to user interaction and not programmatic changes?

Thanks
Aug 6 '08 #1
3 1608
Curtis Rutland
3,256 Expert 2GB
Well, perhaps every time you modify the text in the code, you can set the button's enabled property to false.

That way, the TextChanged (or whatever, the event that fires when the text is changed) sets the button enabled, then the code resets it. But when the user changes the text, the button isn't reset to disabled.
Aug 6 '08 #2
Well, perhaps every time you modify the text in the code, you can set the button's enabled property to false.

That way, the TextChanged (or whatever, the event that fires when the text is changed) sets the button enabled, then the code resets it. But when the user changes the text, the button isn't reset to disabled.
Right, it would just be nicer if we didn't have to worry and do that sort of dependency. Just curious if there was another approach that only listened to user input
Aug 6 '08 #3
Right, it would just be nicer if we didn't have to worry and do that sort of dependency. Just curious if there was another approach that only listened to user input
We are also running into issues that there is no gurantee that:

tb.text ="hi";
button.Enabled = false;

No guarantees that button.Enabled gets run after the event, which means you run into cases where the button is not set.
Aug 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tim Haughton | last post by:
I've just released an article on using Test Driven Development with C# and Windows Forms. GUI's are often difficult to test, so I thought it might be of interest. The article along with the...
4
by: Kathy | last post by:
I have a form to generate a report. On the form are several textboxes and a "Generate" button. I would like to have the button grayed (not enabled), unless the data in each of the dependant...
1
by: Duwayne | last post by:
I am having a lot of trouble with an ascx page that has a textbox that *should fire a textchange event when the text changes. The main aspx page dynamically loads the ascx page and has a image...
11
by: Sandra Castellanos | last post by:
Hello, I want to know what I have to do to make the enter key to submit forms. I read in another newsgroup that inserting an html hidden text box made the trick, and it actually does, but in my...
2
by: Mariano Padilla | last post by:
The calendar control only has the event of SelectionChanged to detect if the user clicks on the calendar. I have 2 calendars on a form, one for arrival date one for departure date. Every time a...
4
by: sowencheung | last post by:
Hi, all The scenario is like this: I have a master page, contains two user controls, one is a search control, another is a login control. The server-side <form> is in the master page,...
0
by: Tom Edelbrok | last post by:
I'm using VS 2005 to develop an intranet asp.net web application and I get a weird situation. If I start out with any ASPX page that contains an ImageButton control followed by a TextBox control,...
14
by: > Adrian | last post by:
Is there a way of stopping text from highlighting in textbox? Many thanks, Adrian.
0
FishVal
by: FishVal | last post by:
It is quite frequently needed to open an auxiliary form from a main one to enter some information. Data entered in the auxiliary form is expected to appear in the main one and optionally treated in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.