简体   繁体   中英

How do I write a code that reads a text from the (textbox) and when I press my (button) it delets all DOTS in the Text?

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.

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(".", "");
}

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(".", "");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM