473,394 Members | 1,640 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,394 software developers and data experts.

Finding what caused TextBox.Text to change?

This seems like it has probably been covered many times before, but
I'm having a hard time finding any discussion about it (probably just
searching the wrong terms).

Is there a way to capture whether the Text of a TextBox has been
changed by code or the user. I don't care if the Text is changed by
code, only if the user changes it. I actually figured out a solution
using a flag for the TextBox

something like:

OnKeyPress()
{
SetBoolFlag(true);
}

OnTextChanged()
{
if (BoolFlag == true)
DoSomething();
}

But, besides not liking how that works, it doesn't handle when a user
may "cut" text out of the TextBox using the mouse.

So, I'm back to my original problem. How can I find out (maybe at the
TextChanged event?) what caused the Text to change?

Any help is greatly appreciated,
Matt

Apr 27 '07 #1
2 1902
"Matt B" <ro**********@gmail.comwrote in message
news:11**********************@r3g2000prh.googlegro ups.com...
But, besides not liking how that works, it doesn't handle when a user
may "cut" text out of the TextBox using the mouse.

So, I'm back to my original problem. How can I find out (maybe at the
TextChanged event?) what caused the Text to change?
AFAIK, you can't find out what caused the text to change. You have to set
flags like you are doing.

Michael
Apr 27 '07 #2
Hi,
"Matt B" <ro**********@gmail.comwrote in message
news:11**********************@r3g2000prh.googlegro ups.com...
This seems like it has probably been covered many times before, but
I'm having a hard time finding any discussion about it (probably just
searching the wrong terms).

Is there a way to capture whether the Text of a TextBox has been
changed by code or the user. I don't care if the Text is changed by
code, only if the user changes it. I actually figured out a solution
using a flag for the TextBox

something like:

OnKeyPress()
{
SetBoolFlag(true);
}

OnTextChanged()
{
if (BoolFlag == true)
DoSomething();
}

But, besides not liking how that works, it doesn't handle when a user
may "cut" text out of the TextBox using the mouse.

So, I'm back to my original problem. How can I find out (maybe at the
TextChanged event?) what caused the Text to change?
AFAIK there is no way of doing it, after all the event is TextChanged , it
does not takes into account how the change occured.

I think you could accomplish this if you extend the TextBox and use a
solution similar to the above but taking all possible events sources.
Apr 27 '07 #3

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

Similar topics

1
by: Chris | last post by:
I have several read only datasheet subforms for which I would like to incorporate a feature similar to the auto expand of a combo box i.e. user presses a series of keys and and the record pointer...
3
by: Vaughn | last post by:
I have a textbox in my Win form that can be filled when a user chooses an emplcode from a combobox and when the value is returned from another form (double-clicks on a separate listbox). What...
4
by: RTM | last post by:
Can anyone help me with the following issue? I've seen some similar questions here, but none relating to a textbox control.... I have a form with several controls, one of them being a textbox...
2
by: Cindy | last post by:
Hi all you smarties out there, I'm having a little conundrum with my asp.net page Scenario: I have a form (asp.net) with no code behind (as yet). I have placed a javascript function on a...
3
by: Martin | last post by:
Hi, I have created a composite control that has a number of standard asp.net controls on it that can themselves cause postbacks. What i need to do in my composite control is to determine which...
8
by: Tor Inge Rislaa | last post by:
Finding the width of a text I need to find the width of a text. When the user change the font in a textbox I want the textbox to fit the text automatically by changing txtMyTextBox.Width...
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
1
by: Mufasa | last post by:
I have a page that has a master page. I'm writing generic code to find multiple controls on the page (I have a number of controls called tbName1, tbName2, tbName3, ..., tbName20) and rather than...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.