C#封装对象

来源:百度知道 编辑:UC知道 时间:2024/05/24 12:44:18
代码:namespace Person
{
public partial class Form1 : Form
{

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Man person = new Man();
person.Iden = textBox1.Text;
person.PName = textBox2.Text;
person.PAge = textBox3.Text;
person.PSex = comboBox1.Text;
MessageBox.Show();

}
}
}
MessageBox.Show();show中应该怎么写?

show("string");
这个方法里面是要放String数据的
你不可以放person 到里面去
如果你想输出person 里的数据
你可以person.iden
这样来输出

你想显示的内容啊

想显示什么就写什么呗。