Results 1 to 3 of 3

Thread: Insert String anywhere in a text box?

  1. #1
    Jimbothegreat
    Guest

    Insert String anywhere in a text box?

    Hi!

    VB Code:
    1. text1.text = "world"
    2. text1.text = text1.text + "hello"

    that would give you "world hello" in the text box, but is it possible to insert text into text box anwhere so that you could rearange it as "hello world"?

  2. #2
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    No, unless you actually backup the previous text and then update the text with new one. But if you want "Hello World", you can do like
    VB Code:
    1. Text1.Text = "Hello" & Text1.Text

    or if you want to insert text somewhere in the middle, use Mid function actually get a certain number of chunks, append the new text to it, get the last chunks, and then update the text in the textbox with the new string.
    Baaaaaaaaah

  3. #3
    Jimbothegreat
    Guest
    Yea i do want to put the text in teh middle! i never thought of getting it as a string and editing that! DOH! i need to put it in where the cursor is. i.e. they click wehere they want the text in the text box and click a button and it puts text in there!

    thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width