---
title: "C# Basics - TextBox event handler"  
description: "C# Basics - TextBox event handler"  
author: "Anonymous User"  
published: 2014-08-14  
updated: 2014-08-14  
canonical: https://www.mindstick.com/forum/2031/c-sharp-basics-textbox-event-handler  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# C# Basics - TextBox event handler

I have a [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) [TextBox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) called MsgBox1 and I have changed the [trigger](https://www.mindstick.com/blog/167/triggers-in-wpf) from LostFocus to ProperyChanged.

When I modify the [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) (i.e. MsgBox1.Text = "Some Text") [execution](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net) branches to the [event handler](https://www.mindstick.com/forum/1371/c-sharp-dot-net-event-handler-delegate-question).

So far, so good.

[Now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now), what do I put in the empty event handler to tell it to actually [update](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) MsgBox1.Text?

```
Hours of searching yields less than helpful results like:    {     // Do Something    }
```

## Replies

### Reply by Pravesh Singh

Hi Chintoo, \

The [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) fires when the textChange event occurs.

you can test this by using the following code :

```
private void textBox1_TextChanged(object sender, EventArgs e){    var currentTextValue = this.textBox1.Text;    var currentTextValueFromObject = (sender as TextBox).Text;}
```

both vars yield the same result. One grabs the object from the event [handler](https://www.mindstick.com/forum/33532/handler-pagehandlerfactory-integrated-has-a-bad-module-managedpipelinehandler-in-its-module-list) while the other grabs it directly from the form.


---

Original Source: https://www.mindstick.com/forum/2031/c-sharp-basics-textbox-event-handler

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
