title: How to move the textbox cursor to the last index of text?
body: <p>I have a text box where the user can enter details up to 140 characters after that a dialog box pop up which showing maximum limit reached .My problem is that after the message box is shown the cursor is blinking at the beginning of the text.and also further typing is possible.I have to do two things one is the cursor should blinking at the end of text after message box shown.and next is when the user hit characters more than 140 it should not be entered in the text box.?Please give me a solution for this</p>
  
  <p>Here is my code.</p>
  
  <pre><code>   private void tbMessage_TextChanged(object sender, TextChangedEventArgs e)
      {
          string txt = tbMessage.Text;
          Regex regx = new Regex("\\(?\\b(http|https)://([-A-Za-z0-9+&amp;@#/%?=~_()|!:,.;\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[-A-Za-z0-9+&amp;@#/%=~_()|])");
          regx.Matches(txt);
  
  
          MatchCollection mactches = regx.Matches(txt);
  
          foreach (Match match in mactches)
          {
              txt = txt.Replace(match.Value, "&lt;---------------------&gt;");
          }
          textBlockNumberLimit.Text = txt.Length.ToString() + "/140";
  
          if (txt.Length &gt; 140)
          {
              try
              {
                  MessageBox.Show("Maximum limit reached", "SPRINKLR", MessageBoxButton.OK);
  
  
                  tbMessage.Text = tbMessage.Text.Substring(0, tbMessage.Text.Length - 1);
  
              }
              catch
              {
              }
          }
  
  
      }
  </code></pre>