标题:messagebox.show问题
只看楼主
花间酒
Rank: 2
等 级:论坛游民
帖 子:13
专家分:24
注 册:2017-4-4
结帖率:100%
已结贴  问题点数:20 回复次数:3 
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 );*/

        }
    }
}
搜索更多相关主题的帖子: using System public obj WriteLine 
2017-09-06 09:36
winners
Rank: 6Rank: 6
来 自:济南
等 级:侠之大者
威 望:1
帖 子:105
专家分:416
注 册:2009-3-20
得分:20 
            FileStream fs = File.Create("C:\\store.txt");
            StreamWriter sw = new StreamWriter(fs);
 sw.WriteLine(textBox1.Text);
            sw.WriteLine(textBox2.Text);
            sw.WriteLine(textBox3.Text);
//
            sw.Close();
            fs.Close();
2017-09-06 10:49
花间酒
Rank: 2
等 级:论坛游民
帖 子:13
专家分:24
注 册:2017-4-4
得分:0 
按着您的方法做了,但是出现如下情况

还请各位大神们再指教一下
2017-09-12 20:19
winners
Rank: 6Rank: 6
来 自:济南
等 级:侠之大者
威 望:1
帖 子:105
专家分:416
注 册:2009-3-20
得分:0 
你这是点击了好多次按钮吧 还是放进循环里了  正常 点一次按钮写一次
2017-09-15 23:46



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




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

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