-1

I have to remove whitespaces in username textbox android when ever I put . there is always whitespace occurs for example (john. james) like this please let me know how to resolve this problem on while typing there should not be any space in between.

  • https://forums.xamarin.com/discussion/92427/how-to-avoid-empty-space-in-text-field-in-xamarin-forms – Volkmar Rigo Feb 20 '21 at 08:05
  • Does this answer your question? [How to disable space character in a text field in ios xamarin](https://stackoverflow.com/questions/42031635/how-to-disable-space-character-in-a-text-field-in-ios-xamarin) – Volkmar Rigo Feb 20 '21 at 08:05
  • 1
    Here is [a similar question](https://stackoverflow.com/questions/25086881/restricting-input-length-and-characters-for-entry-field-in-xamarin-forms) – Ibram Reda Feb 20 '21 at 08:06
  • Does this answer your question? [Restricting input length and characters for Entry field in Xamarin.Forms](https://stackoverflow.com/questions/25086881/restricting-input-length-and-characters-for-entry-field-in-xamarin-forms) – Cfun Feb 20 '21 at 08:50

1 Answers1

0

this should solve your problem

using System.Text.RegularExpressions;

private void TextBox1_TextChanged(object sender, EventArgs e)
{
   TextBox1.Text = Regex.Replace(TextBox1.Text, " ", "");
}
msaba
  • 76
  • 4