Author Topic: UIinput.value.Insert doesn't seem to work!  (Read 8130 times)

samshosho

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
UIinput.value.Insert doesn't seem to work!
« on: September 23, 2015, 09:39:39 AM »
I have a string, that i want to insert at the end of the UIinput value.
So i did this,

CurIndex = UIinput.value.Length;
UIinput.value.Inser(CurIndex, "some string");

It shows the correct index of the UIinput field, however, it won't insert the "some string" at all.

Am i doing something wrong ?
« Last Edit: September 23, 2015, 10:35:27 AM by samshosho »

samshosho

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: UIinput.value.Insert doesn't seem to work!
« Reply #1 on: September 25, 2015, 06:20:17 AM »
any help would be appreciated :)

betodeoliveira

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UIinput.value.Insert doesn't seem to work!
« Reply #2 on: September 26, 2015, 12:26:55 AM »
I think this might work:

UIinput.value = UIinput.value + "some string";

mcarriere

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: UIinput.value.Insert doesn't seem to work!
« Reply #3 on: September 26, 2015, 01:50:23 PM »
This is because string.Insert returns the new string you are editing, it doesn't edit the existing one: https://msdn.microsoft.com/en-us/library/system.string.insert(v=vs.110).aspx

betodeoliveira's suggestion will do what you're looking for, the main bit is that he's setting the UIinput.value