stromberg10
asked on
Insert variable at the cursor in an textbox
I've a function which inserts todays date in a textbox like this: textbox.Text = textbox.Text + date
As you can see the date gets written in the end of the textbox.
How it looks like now, if I insert the date:
"I was in Sweden. It was fun." + date
I wanna have it like this:
"I was in Sweden" + date + ". It was fun."
I've tested some with SelectStart and so on, but with no success.
Hopes you understand and are willing to help =)!
As you can see the date gets written in the end of the textbox.
How it looks like now, if I insert the date:
"I was in Sweden. It was fun." + date
I wanna have it like this:
"I was in Sweden" + date + ". It was fun."
I've tested some with SelectStart and so on, but with no success.
Hopes you understand and are willing to help =)!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I made it myself :D, but thanks for the help!
I did like this:
textBox.Text = textBox.Text.Insert(textBo x.Selectio nStart, Date.Now)
I did like this:
textBox.Text = textBox.Text.Insert(textBo
TextBox1.Focus()
TextBox1.SelectionStart = 5
TextBox1.SelectionLength = 0
~IM