Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 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 Assignment_1
  12. {
  13. public partial class Form5 : Form
  14. {
  15. public Form5()
  16. {
  17. InitializeComponent();
  18. button2.UseMnemonic = false;
  19. }
  20.  
  21. private void button2_Click(object sender, EventArgs e)
  22. {
  23. DialogResult results;
  24. results = saveFileDialog1.ShowDialog();
  25. StreamWriter str1 = new StreamWriter(saveFileDialog1.FileName +".txt");
  26.  
  27. str1.WriteLine("Patient name: " + textBox1.Text);
  28. str1.WriteLine("Blood pressure: " + textBox2.Text);
  29. str1.WriteLine("Height: " + textBox3.Text);
  30. str1.WriteLine("Weight: " + textBox4.Text);
  31. str1.WriteLine("BMI: " + textBox5.Text);
  32. str1.Close();
  33. }
  34.  
  35. private void button1_Click(object sender, EventArgs e)
  36. {
  37. DialogResult results;
  38.  
  39. results = openFileDialog1.ShowDialog();
  40.  
  41. StreamReader rd1 = new StreamReader(openFileDialog1.FileName);
  42.  
  43. textBox1.AppendText(rd1.ReadLine());
  44. textBox2.AppendText(rd1.ReadLine());
  45. textBox3.AppendText(rd1.ReadLine());
  46. textBox4.AppendText(rd1.ReadLine());
  47. textBox5.AppendText(rd1.ReadLine());
  48. rd1.Close();
  49. }
  50.  
  51. private void Form5_Load(object sender, EventArgs e)
  52. {
  53.  
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement