这段代码有什么问题
在执行了button1_Click,在满足if的条件下,richTextBox4无输出。请大家指点下,谢谢!
using System;
using System.Collections.Generic;
.....
namespace InfoSearch
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
char[] Name = richTextBox1.Text.ToCharArray();
string a = Name[0].ToString();
string b = richTextBox2.Text.Trim();
string c = richTextBox3.Text.Trim();
string r1 = "";
string r2 = "";
richTextBox4.Text = r1.ToString() + r2.ToString();//输出if的结果
if ((a == "北" || a == "上") && (b == "地铁" || b == "公交"))
{
r1 = "拥堵";
}
else
r1 = "";
if ((a == "成" || a == "西") && (b == "铁路" || b == "飞机"))
{
r1 = "少量";
}
else
r1 = "";
if ((c == "游客" || c == "背包客") && (b == "铁路" || b == "飞机"))
{
r2 = "增加中";
}
else
r2 = "";