Advertisement
vladim_ch

Untitled

May 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 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.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11.  
  12. namespace WindowsFormsApp1
  13. {
  14.     public partial class Form2 : Form
  15.     {
  16.  
  17.  
  18.  
  19.         public void saveTextToFile(string filename, string textToSave)
  20.         {
  21.            
  22.            
  23.  
  24.            
  25.             try
  26.             {
  27.                 File.WriteAllText(filename, textToSave); //сохранение данных тут
  28.                
  29.             }
  30.             catch (Exception ex)
  31.             {
  32.                 MessageBox.Show("Ошибко тут: " + ex.Message);
  33.             }
  34.         }
  35.  
  36.  
  37.         public Form2()
  38.         {
  39.  
  40.  
  41.             InitializeComponent();
  42.         }
  43.  
  44.         private void button1_Click(object sender, EventArgs e)
  45.         {
  46.            
  47.            
  48.             saveTextToFile(textBox2.Text, textBox1.Text + " " + textBox2.Text + " " + textBox3.Text);
  49.             Form3 form3 = new Form3(this.textBox1.Text, this.textBox2.Text, this.textBox3.Text);
  50.  
  51.          
  52.             form3.txt2 = this.textBox2.Text; //объявление ссылок
  53.             form3.txt1 = this.textBox1.Text;
  54.             form3.txt3 = this.textBox3.Text;
  55.    
  56.  
  57.  
  58.  
  59.         }
  60.      
  61.         private void button2_Click(object sender, EventArgs e)
  62.         {
  63.             Close();
  64.         }
  65.  
  66.         private void Form2_Load(object sender, EventArgs e)
  67.         {  
  68.  
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement