Question: I have in my MainPage() the following line of code:

```
string str = tbx1.Text;

```

Then I have a slider that changes this TextBox:

```
    private void Slider_ValueChanged_1(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
        Slider slider1 = sender as Slider;
        tbx1.Text = slider1.Value.ToString();

    }

```

When I run the app the default value of `tbx1` is read in, and it can be changed with the slider. But how do I read in the new value of `tbx1` into `str`? It seems that only the default value is kept in `str`.

Answer: 
If string is accessable you can do the following

```
private void Slider_ValueChanged_1(object sender, RoutedPropertyChangedEventArgs<double> e)
{
    Slider slider1 = sender as Slider;
    tbx1.Text = slider1.Value.ToString();
    str = slider1.Value.ToString();
}

```
if you want to change str when `tbx1.Text` you can do that :

youcan declare your value in your class 

```
private string _str

```

then you have to make your code : (you have to add Leave function to your textbox)

```
private void tbx1_Leave(object sender, EventArgs e)
{
    _str = tbx1.Text;
}

private void Slider_ValueChanged_1(object sender, RoutedPropertyChangedEventArgs<double> e)
{
    Slider slider1 = sender as Slider;
    _str = tbx1.Text = slider1.Value.ToString();

}

```