Home > front end >  How do I write a code that reads a text from the (textbox) and when I press my (button) it delets al
How do I write a code that reads a text from the (textbox) and when I press my (button) it delets al

Time:11-28

I have 2 Textboxes. One for a text you can paste in and one that will give you the same text but without any dots in it.

CodePudding user response:

You can write above code in single line to replace textbox value.

private void TextBox1_TextChanged(object sender, EventArgs e)
{
    TextBox2.Text = TextBox1.Text.Replace(".", "");
}

CodePudding user response:

There are lots of ways to do this .

1 simple way

  private void TextBox1_TextChanged(object sender, EventArgs e)
{
    TextBox2.Text = TextBox1.Text;
    TextBox2.Text = TextBox2.Text.Replace(".", "");
}
  • Related