Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10.  
  11. namespace Kadai02
  12. {
  13. public partial class FrmMeiboToroku : Form
  14. {
  15. private const string MEIBOFILE = @"Z:\WinPro\Lesson04\名簿.txt";
  16. public FrmMeiboToroku()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void btnSelect_Click(object sender, EventArgs e)
  22. {
  23. FrmKen form = new FrmKen();
  24.  
  25. form.ShowDialog();
  26. txtJusyo.Text = form.kenmei;
  27. }
  28.  
  29. private void btnToroku_Click(object sender, EventArgs e)
  30. {
  31. string line = "";
  32.  
  33. if (txtName.Text != "" && txtJusyo.Text != "")
  34. {
  35. line = txtName.Text + ",";
  36.  
  37. if (rdoMan.Checked)
  38. {
  39. line += "男";
  40. }
  41. else
  42. {
  43. line += "女";
  44. }
  45.  
  46. StreamWriter wr = new StreamWriter(MEIBOFILE, true);
  47.  
  48. wr.WriteLine(line + "," + txtJusyo.Text);
  49. wr.Close();
  50. }
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement