private void button1_Click(object sender, EventArgs e)
{
object xingBie;
if (radioButton1.Checked)
xingBie = radioButton1.Text;
else
xingBie = radioButton2.Text;
listBox1.Items.Add(textBox1.Text+" "+comboBox1.Text+"-"+comboBox2.Text+"-"+comboBox3.Text+" "+xingBie+" "+textBox2.Text+" "+textBox3.Text);
}
我想做一个通讯录,把我输进去的内容显示在一个Listbox中,可是我在编通讯录的时候发现显示不出来那个性别,所以用一个Object变量来保存,可是为什么显示出来的还是2跟线啊?
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
listBox1.Items.Add(textBox1.Text+" "+comboBox1.Text+"-"+comboBox2.Text+"-"+comboBox3.Text+" "+"男"+" "+textBox2.Text+" "+textBox3.Text);
else
listBox1.Items.Add(textBox1.Text+" "+comboBox1.Text+"-"+comboBox2.Text+"-"+comboBox3.Text+" "+"女"+" "+textBox2.Text+" "+textBox3.Text);
}
我不知道C#里面字符串的是怎么定义的 所以.....