Questions tagged [textchanged]

An event that occurs when the text/content of a UI element has changed.

Definition:

The TextChanged event is an event that occurs when the text or content of a UI element has changed.

Most of the time this will be the text/content of a textbox. In general this event is not bound to a specific language or framework. The event can be captured in .NET, JAVA, JavaScript, ...

Examples:

  • .NET

    • WindowsForms

      TextBox _nameTextBox = new TextBox();
      _nameTextBox.TextChanged += new EventHandler(NameTextBox_TextChanged);
      
      private void NameTextBox_TextChanged(object sender, EventArgs e)
      {
          //Handle event
      }
      
    • WPF

      <TextBox TextChanged="MyTextBox_TextChanged">Default text</TextBox>
      
      private void MyTextBox_TextChanged(object sender, TextChangedEventArgs args)
      {
          //Handle event
      }
      
  • JAVA

    JTextField nameTextField = new JTextField();
    
    nameTextField .getDocument().addDocumentListener(new DocumentListener() {
    
        public void removeUpdate(DocumentEvent e) {
        }
    
        public void insertUpdate(DocumentEvent e) {
        }
    
        public void changedUpdate(DocumentEvent e) {
        }
    }); 
    
  • HTML/JavaScript

    <input type="text" id="name" onchange="nameChanged()">
    
    function nameChanged() {
        var name = document.getElementById("name");
        //Handle event
    }
    

More reading:

287 questions
5
votes
4 answers

Android: why i am not able to change the value of EditText with respect to another EditText?

I am going to change the text of the edittext based on the value enter on the another edittext. and also like same thig with visa-versa. For that i have use the TextChanged Listener and implemented as like below: …
Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188
5
votes
4 answers

Textbox.TextChanged triggering when page is loaded. How do I prevent it?

I am having trouble with textbox.textchanged event. my textboxes are data-bound and when the page is loaded, textchanged event triggers. How do I prevent it from happening and only trigger when the user makes any sort of changes?
will0809
  • 237
  • 1
  • 5
  • 16
5
votes
1 answer

c# Textchanged event fires twice in a multiline TextBox

I have a very bizarre problem with the TextChanged event in a multiline TextBox (WinForms). it appears that the event fires twice under certain circumstances. This complete code demonstrates the issue: public partial class TextChangedTest : Form { …
Blind Fury
  • 469
  • 3
  • 15
4
votes
4 answers

Text change events in jquery with Asp.net

I have 2 textboxes and If I write anythng in textbox1 it should reflect immediately in textbox2 and If I write anything in textbox2 it should reflect in textbox1. So how do I do that? I have seen this article before and how to Implement between two…
coder
  • 13,002
  • 31
  • 112
  • 214
4
votes
4 answers

TextBox TextChanged event does not fire when Visible = False?

I have a textbox bound to a datasource. The textbox's TextChanged event updates another textbox. The problem is, I do not want the first textbox to show, so I set its Visible property to false. However, now the TextChanged event does not fire! I…
Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
4
votes
3 answers

MS Word's Add-in TextChange Event in C#

I have a Microsoft Word Add-in that find the similar words in a text (But When I click a button !) My question is : how to call a function when user typed words ? In other word , i want an event like "TextChange" or "Keypress" when user typing to…
Reza-S4
  • 1,042
  • 1
  • 18
  • 36
4
votes
1 answer

WPF RichTextBox PreviewKeyDown and OnTextChange event order differs from normal TextBox

I am having some issues with the WPF RichTextBox. I have created a behavior which works on both a normal TextBox, and a RichTextBox. In the behavior, I am using two events:- OnTextChanged - OnPreviewKeyDown I assumed that OnPreviewKeyDown always…
Olrox
  • 41
  • 4
4
votes
5 answers

how to get sum dynamically of datagridview column in textbox

I want to get the sum of a column of datagridview and show that in textbox. After each entry the sum should be changed dynamically. For that I am using textChanged event of a textbox but when the entry is made it does not show any result. I want to…
Haider Khattak
  • 567
  • 3
  • 8
  • 32
4
votes
1 answer

textChanged event not triggering in Pyqt4

How come the textChanged event is not happening whenever I input some data in the QLineEdit? from PyQt4.Qt import Qt, QObject,QLineEdit from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT from PyQt4 import QtGui, QtCore import sys class…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
3
votes
2 answers

asp.net textbox - client side textChanged event won't fire

i want my textbox to fire a textChanged client side (JS) event when a text is changed inside it. i read many posts about it. most of them are talking about a code-behind event and the ones that talk about the client side tells to add attribute of…
Rodniko
  • 4,926
  • 20
  • 69
  • 93
3
votes
1 answer

How do I keep bindings from firing TextChanged event?

I'm using the Control.TextChanged event to detect when the user has modified the form. I have a method that loops through every control and adds the same TextChanged to all the controls. My problem is, on the form I also have databinding that binds…
Isaac
  • 43
  • 1
  • 7
3
votes
2 answers

Trying to multiply and get the sum of result into a textbox using TextChanged as event

I'm new to using C# and Visual Studio and i'm having a problem. I'm trying to calculate a total value of three different multiplications using TextChanged event, so the total textbox updates every time I input a number in the textboxes I am using…
MCoyle
  • 35
  • 4
3
votes
4 answers

Change text on hover, CSS and html

I want to change the text when hovering over a speechbubble (already created) and set the text back when the mouse goes back. I have a "Welcome!" text set on the speechbubble and I want it to change to "Scroll down". The other issue is that I have…
Maëlle
  • 629
  • 1
  • 11
  • 25
3
votes
1 answer

C# Serial port- Not all data added to Listview

so I am transmitting data from an Arduino to a C# Winform that outputs the data to a text box and saves it to a file. The format of the transmitted data is as follows 18|25|999|100~; the first part is the time in seconds which allows me to know when…
Gabe
  • 164
  • 1
  • 2
  • 10
3
votes
2 answers

C# - TextBox_TextChanged event - revert to previous value

I'm posting a confirmation dialog on TextBox_TextChanged event. If the user hits 'No', I'd like to somehow revert the textbox to its old value (i.e. before it was changed) But at the point the event is triggered, the TextBox.Text is already the…
eranfu
  • 55
  • 1
  • 9
1
2
3
19 20