本文介绍了如何在C#Visual Studio 2008中一一删除文本框中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在主要形式中,我有一个textBox,一个radioButton(在这里,我将Apprerance设置为Button).问题是,当我单击该radioButton时,每个单词(在textBox中)将被一一删除.我怎样才能做到这一点?

In main form I have a textBox, a radioButton (here I''ve set Apprerance to Button). The thing is I want when I click on that radioButton every word (that is in the textBox) will be deleted one by one. How can I do that? Thanks in advanced!

推荐答案

private void button1_Click(object sender, EventArgs e)
{
    string sValue = textBox1.Text;
    string[] arrValues = sValue.Split(new char[] { ' ' });
    for (int i = 0; i < arrValues.Length; i++)
    {
        arrValues[i] = arrValues[i].ToString().Replace(arrValues[i].ToString(), "");
    }
    for (int o = 0; o < arrValues.Length; o++)
    {
        textBox1.Text = arrValues[o].ToString();
    }
}




谢谢
Chageie




Thanks
Chageie




这篇关于如何在C#Visual Studio 2008中一一删除文本框中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:47