标题:为什么输入空格就出错了啊?
取消只看楼主
需要指点
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-9-14
结帖率:100%
已结贴  问题点数:20 回复次数:0 
为什么输入空格就出错了啊?
        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string inputstr = new string (textBox1.Text.ToCharArray());
            string outputstr = null;
            char ch1;
            for (int i = 0; i <= inputstr.Length - 1; i++)
            {
                ch1 = inputstr[i];
                if (ch1 == 'a' || ch1 == 'A' || ch1 == 'o' || ch1 == 'O' || ch1 == 'u' || ch1 == 'U' ||                      ch1 == 'e' || ch1 == 'E')
                {
                    outputstr += "egg";
                    outputstr += ch1.ToString();

                }
                else
                {
                    outputstr = ch1.ToString();
                }


                    textBox2.Text = outputstr;
               
            }
            }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
        }
            }
    }
搜索更多相关主题的帖子: private null void 
2012-09-14 21:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-381409-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.095258 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved