title: automatic capital letter at the beginning of a word when typing in textbox
body: <p>I would like to create a function when typing in textbox the beginning of each sentence automatically becomes large. </p>
  
  <p>I've been unsuccessfully trying to make with VB.Net, but when I tried with C # can not run properly. </p>
  
  <p>I do not know where my mistake, I hope anyone of you can help improve my C# code thank you.</p>
  
  <p>My Function In Class C# (failed) :</p>
  
  <pre><code>    class ClsText
  {
      public int Current_Point = 0;
      public bool Remove_Handle = false;
      public string tulis(string text)
      {
          string[] validasi_char = new string[] { " ", ".", "(", ")", "!", "@", "$", "%", "&amp;", "*", "/", "?", "+", "-", ",", "&gt;", "&lt;", "'", "~", "`" };
          string str_temp = "";
  
          foreach (string vchar in validasi_char)
          {
              string[] split_temp = text.Split(validasi_char,StringSplitOptions.);
              str_temp = "";
              foreach (string txt in split_temp)
              {
                  str_temp = str_temp + txt.Substring(0,0).ToUpper() + txt.Substring(1, txt.Length) + vchar;
              }
              text = str_temp.Substring(0, str_temp.Length - 1);
          }
          text = text.Substring(0, 0).ToUpper() + text.Substring(1, text.Length);
          return text;
      }
  }
  </code></pre>
  
  <p>My code in textbox C# (failed) :</p>
  
  <pre><code>            ClsText asd = new ClsText();
          if (asd.Remove_Handle == true) 
          {
             asd.Current_Point = textEdit1.SelectionStart;
             asd.Remove_Handle = true;
             textEdit1.Text = asd.tulis(textEdit1.Text);
  
          }
          textEdit1.Select(asd.Current_Point, 2);
  </code></pre>
  
  <p>My Function In VB.NET (success) :</p>
  
  <pre><code>    Public current_point As Integer = 0
      Public remove_handle As Boolean = False
      Public Function Tulis(ByVal Text As String) As String
      Dim validasi_char() As String = {" ", ".", "(", ")", "!", "@", "$", "%", "&amp;", "*", "/", "?", "+", "-", ",", "&gt;", "&lt;", """", "'", "~", "`"}
      Dim str_temp As String = ""
      For Each vchar In validasi_char
          Dim split_temp() As String = Split(Text, vchar)
          str_temp = ""
          For Each txt In split_temp
              str_temp = str_temp + Mid(txt, 1, 1).ToUpper + Mid(txt, 2, txt.Length) + vchar
          Next
          Text = Mid(str_temp, 1, str_temp.Length - 1)
      Next
      Text = Mid(Text, 1, 1).ToUpper + Mid(Text, 2, Text.Length)
      Return Text
  End Function
  </code></pre>
  
  <p>My code in textbox VB.Net (success) :</p>
  
  <pre><code>    Private Sub TextEdit1_EditValueChanging(sender As Object, e As DevExpress.XtraEditors.Controls.ChangingEventArgs) Handles TextEdit1.EditValueChanging
      If remove_handle = True Then GoTo DoCurrentPoint
      current_point = TextEdit1.SelectionStart
      remove_handle = True
  
      TextEdit1.Text = Tulis(TextEdit1.Text)
  </code></pre>
  
  <p>DoCurrentPoint:
          remove_handle = False
          TextEdit1.Select(current_point, 0)
      End Sub</p>