using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
namespace Suche
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
cmbLaufwerk.Items.AddRange(Environment.GetLogicalDrives());
}
private void cmdSuchen_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
string path = cmbLaufwerk.Text;
string searchPattern = "*"+txtSuchbegriff.Text+"*";
try
{
DirectoryInfo di = new DirectoryInfo(path);
FileInfo[] files = di.GetFiles(searchPattern, SearchOption.AllDirectories);
foreach (FileInfo file in files)
{
progressBar1.Value += 1;
if ((file.Name.Contains(txtSuchbegriff.Text)) && (file.Extension == ".doc"))
{
listView1.Items.Add(file.Name);
}
}
}
catch
{
MessageBox.Show("Es ist ein Fehler aufgetreten");
}
}
private void dateiToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void überToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 NeuesFenster = new Form2();
NeuesFenster.ShowDialog();
}
private void öffnenToolStripMenuItem1_Click(object sender, EventArgs e)
{
Process.Start("WINWORD.exe", "x:\\test.doc");
}
private void öffnenToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("WINWORD.exe", "x:\\test.doc");
}
}
}