messagebox.show问题
想在弹出的窗体上显示前面写的结构体的信息,注释是我尝试过的方法,代码如下:using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using
namespace address1
{
public struct mes {
public string name;
public string address;
public string telephone;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button4_Click(object sender, EventArgs e)
{
FileStream fs = File .Create("C:\\store.txt");
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(textBox1 );
sw.WriteLine(textBox2 );
sw.WriteLine(textBox3 );
fs.Close();
}
private void button3_Click(object sender, EventArgs e)
{
mes obj=new mes ();
StreamReader sr = new StreamReader("C:\\store.txt");
obj.name = sr.ReadLine();
// MessageBox .Show ();
obj.telephone = sr.ReadLine();
// MessageBox .Show (obj .telephone );
obj.address = sr.ReadLine();
//MessageBox .Show ("",obj.telephone );
/*Console.WriteLine("{0}",obj .name );
Console.WriteLine("{0}",obj .telephone );
Console.WriteLine("{0}",obj .address );*/
}
}
}