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 Window4.xaml
/// </summary>
public partial class Window4 : Window
{
public Window4()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
DriveInfo[] strdrives = DriveInfo.GetDrives();
foreach (DriveInfo strdrive in strdrives)
{
listBox1.Items.Add(strdrive);
}
}
}
}
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 Window5.xaml
/// </summary>
public partial class Window5 : Window
{
public Window5()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
DriveInfo[] strdrives = DriveInfo.GetDrives();
foreach (DriveInfo strdrive in strdrives)
{
listBox1.Items.Add(string.Format("Drive{0}",strdrive.Name));
listBox1.Items.Add(string.Format("File type:{0}",strdrive.DriveType));
listBox1.Items.Add(string.Format("Volume Label:{0}", strdrive.VolumeLabel));
listBox1.Items.Add(string.Format("File System:{0}", strdrive.DriveFormat));
listBox1.Items.Add(string.Format("Available space to current user:{0,15}bytes", strdrive.AvailableFreeSpace));
listBox1.Items.Add(string.Format("Total available space:{0,15}bytes", strdrive.TotalFreeSpace));
listBox1.Items.Add(string.Format("Total size of drive:{0,15}bytes", strdrive.TotalSize));
}
}
}
}
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 Window5.xaml
/// </summary>
public partial class Window5 : Window
{
public Window5()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
DriveInfo[] strdrives = DriveInfo.GetDrives();
foreach (DriveInfo strdrive in strdrives)
{
listBox1.Items.Add(string.Format("Drive{0}",strdrive.Name));
listBox1.Items.Add(string.Format("File type:{0}",strdrive.DriveType));
listBox1.Items.Add(string.Format("Volume Label:{0}", strdrive.VolumeLabel));
listBox1.Items.Add(string.Format("File System:{0}", strdrive.DriveFormat));
listBox1.Items.Add(string.Format("Available space to current user:{0,15}bytes", strdrive.AvailableFreeSpace));
listBox1.Items.Add(string.Format("Total available space:{0,15}bytes", strdrive.TotalFreeSpace));
listBox1.Items.Add(string.Format("Total size of drive:{0,15}bytes", strdrive.TotalSize));
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class linenumber : Form
{
public linenumber()
{
InitializeComponent();
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Text file(*.txt)|*.txt";
string filename;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
filename = openFileDialog1.FileName;
int dr = 0;
FileStream f = new FileStream(filename, FileMode.Open);
StreamReader sr = new StreamReader(f);
string line;
StreamWriter sw = File.CreateText(@"E:\numbered.txt");
while ((line = sr.ReadLine()) != null)
{
dr++;
sw.WriteLine("{0}{1}", dr, line);
}
sw.Close();
f.Close();
MessageBox.Show("File numbered successfully");
System.Diagnostics.Process.Start(@"E:\numbered.txt");
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class linenumber : Form
{
public linenumber()
{
InitializeComponent();
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Text file(*.txt)|*.txt";
string filename;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
filename = openFileDialog1.FileName;
int dr = 0;
FileStream f = new FileStream(filename, FileMode.Open);
StreamReader sr = new StreamReader(f);
string line;
StreamWriter sw = File.CreateText(@"E:\numbered.txt");
while ((line = sr.ReadLine()) != null)
{
dr++;
sw.WriteLine("{0}{1}", dr, line);
}
sw.Close();
f.Close();
MessageBox.Show("File numbered successfully");
System.Diagnostics.Process.Start(@"E:\numbered.txt");
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class string_format : Form
{
public string_format()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(string.Format("I am {0} specializing in {1}","sunitha",".net"));
MessageBox.Show(string.Format("I am {0} specializing in {1} based at {2}","sunitha",".net","asp"));
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class filewatcher : Form
{
public filewatcher()
{
InitializeComponent();
}
private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
{
MessageBox.Show(e.Name);
}
}
}

