# Adding vB code like to a textfield - correctly!

**URL:** <https://forum.kirupa.com/t/adding-vb-code-like-to-a-textfield-correctly/107207>\
**Category:** Uncategorized\
**Created:** [April 13, 2004, 7:18am UTC](https://forum.kirupa.com/t/adding-vb-code-like-to-a-textfield-correctly/107207 "2004-04-13T07:18:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![comicGeek](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@comicGeek](https://forum.kirupa.com/u/comicGeek)\
**Post date:** [April 13, 2004, 7:18am UTC](https://forum.kirupa.com/t/adding-vb-code-like-to-a-textfield-correctly/107207/1 "2004-04-13T07:18:50Z")

</div>

Hello. I have made a shout box with buttons to let the user add smileys, formatting etc. I have done this perfectly but my problem is this. When adding the code to the textfield for example [b] and [/ b], it always adds to the end of the textfield and not where the cursor is on. How can I do this? Like for example in this forum I highlight a text and click on the B button the code [b] and [/ b] wraps around and the highlighted text. :-/
