Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- namespace Kadai03
- {
- public partial class FrmMeibo : Form
- {
- private const string MEIBOFILE = @"Z:\WinPro\Lesson04\Meibo.txt";
- StreamReader reader = new StreamReader(MEIBOFILE);
- private DialogResult ret;
- public FrmMeibo()
- {
- InitializeComponent();
- }
- private void FrmMeibo_Load(object sender, EventArgs e)
- {
- FrmLogin form = new FrmLogin();
- ret = form.ShowDialog();
- if (reader.Peek() != -1)
- {
- string line = reader.ReadLine();
- char[] separate = { ',' };
- string[] fields = line.Split(separate);
- txtName.Text = fields[0];
- txtSeibetu.Text = fields[1];
- txtJusyo.Text = fields[2];
- }
- }
- private void btnNext_Click(object sender, EventArgs e)
- {
- if (ret == DialogResult.OK)
- {
- if (reader.Peek() != -1)
- {
- string line = reader.ReadLine();
- char[] separate = { ',' };
- string[] fields = line.Split(separate);
- txtName.Text = fields[0];
- txtSeibetu.Text = fields[1];
- txtJusyo.Text = fields[2];
- }
- else
- {
- MessageBox.Show("終わりです", "EOF", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- private void FrmMeibo_FormClosing(object sender, FormClosingEventArgs e)
- {
- reader.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement