Question: There's an interesting [trending question](https://stackoverflow.com/questions/46043445/how-to-append-group-row-into-dataframe) in [r](/questions/tagged/r "show questions tagged 'r'"), it goes like this:

> 
> I have this df1:
> 
> 
> 
> ```
> A B C
> 1 2 3
> 5 7 9
> 
> ```
> 
> where `A B C` are columns names.
> 
> 
> I have another df2 with one column:
> 
> 
> 
> ```
> A
> 1
> 2
> 3
> 4
> 
> ```
> 
> I would like to append df2 for each column of df1, creating this final
>  dataframe:
> 
> 
> 
> ```
> A B C 
> 1 2 3
> 5 7 9
> 1 1 1
> 2 2 2
> 3 3 3
> 4 4 4
> 
> ```
> 
> is it possible to do it?
> 
> 
> 

I was wondering, how would this be done in Pandas? 

---

I've posted my own solution below, but I'm also looking for other, better alternatives!

Answer: 
Per Ken-White's comment, you need to attach onto the SelectionChanged event

```
{
     rtb.SelectionChanged += SelectionChangedEventHandler;
}

void SelectionChangedEventHandler(object sender, EventArgs ev)
{
    RichTextBox rb = sender as RichTextBox;
    Console.WriteLine(rb.SelectedText);
}

```
Ryan's answer is correct. But you can do this with the designer as well.

* Select your RichTextBox
* Bring up Properties (F4 is the default)
* Click the [Events] button (green in image below)
* Double-click "SelectionChanged" (red in image below)

[![enter image description here](https://i.stack.imgur.com/RUX6S.png)](https://i.stack.imgur.com/RUX6S.png)