6 March 2014

File Creation with textboxes in C#.net

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window2.xaml
    /// </summary>
    public partial class Window2 : Window
    {
        public Window2()
        {
            InitializeComponent();
        }
        StreamWriter sw;
        private void button1_Click(object sender, RoutedEventArgse)
        {
            sw = File.CreateText(@"E:\" + txtname.Text + ".txt");
            sw.WriteLine("\t\t\tCurriculam vitae");
            sw.WriteLine("Name\t:" + txtname.Text);
            sw.WriteLine("Email\t:" + txtemail.Text);
            sw.Close();
            System.Diagnostics.Process.Start("notepad.exe",@"E:\" + txtname.Text + ".txt");


        }
    }
}
 

 

No comments:

Post a Comment