Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 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 Kadai01
  12. {
  13. public partial class FrmKakunin : Form
  14. {
  15. public string str1;
  16. public string str2;
  17. private const string ADDRESFILE = (@"Z:\WinPro\Lesson04\kadai01.txt");
  18.  
  19. public FrmKakunin()
  20. {
  21. InitializeComponent();
  22. }
  23. private void FrmKakunin_Load(object sender, EventArgs e)
  24. {
  25. txtGakusekiNo.Text = str1;
  26. txtName.Text = str2;
  27. }
  28.  
  29. private void btnToroku_Click(object sender, EventArgs e)
  30. {
  31. if (str1 != "" && str2 != "")
  32. {
  33. string line = "";
  34. line += str1 + ",";
  35. StreamWriter sw = new StreamWriter(ADDRESFILE);
  36. sw.WriteLine(line + str2);
  37.  
  38. sw.Close();
  39.  
  40. DialogResult = DialogResult.OK;
  41. }
  42. }
  43.  
  44. private void btnCancel_Click(object sender, EventArgs e)
  45. {
  46. this.Close();
  47. }
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement