I set up a context menu item for some of my text boxes that inserts the current date at the current cursor position in the text box. I normally use a string builder when concatenating strings but don't know if this situation warrants it. The code looks something like
SelStart is the current cursor position and NowDateTime is the curent datetime. Should I use a string builder here?
Auguy
Sylvania/Toledo Ohio
Code:
myBox.Text = Left(myBox.Text, SelStart) + NowDateTime.ToString("MM/dd/yyyy") + " -" + Mid(myBox.Text, SelStart + 1)
myBox.SelectionStart = SelStart + 13
Auguy
Sylvania/Toledo Ohio