Sayfalar
9 Nisan 2016 Cumartesi
SON ÇALIŞILAN DOSYALAR
SON ÇALIŞILAN DOSYALARI GÖRME,ÇALIŞTIRMA.SİLME PROJESİ
İNDİR
Imports System.IO, System.Diagnostics, System.ComponentModel Public Class Form1 Dim SonCalDsyKlasoru As String = Environment.GetFolderPath(Environment.SpecialFolder.Recent) Private Property eleman As ListViewItem Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load SCDsyGosterBtn.PerformClick() End Sub Private Sub SCDsyGosterBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SCDsyGosterBtn.Click ListView1.Items.Clear() Dim lstitem As New ListViewItem() imageList1.Images.Clear() For Each SonCalDsy In Directory.GetFiles(SonCalDsyKlasoru) Dim yol As String yol = Path.GetFileNameWithoutExtension(SonCalDsy) imageList1.Images.Add(SonCalDsy, Icon.ExtractAssociatedIcon(SonCalDsy)) 'Dosya adı ve ikonu lstitem = ListView1.Items.Add(Path.GetFileNameWithoutExtension(SonCalDsy), SonCalDsy) lstitem.SubItems.Add(New FileInfo(SonCalDsy).CreationTime.ToLongDateString()) 'Tarih ToLongDateString lstitem.SubItems.Add(SonCalDsy) 'yol ekle Next End Sub Private Sub ListView1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick Try Process.Start(TextBox1.Text) Catch m As Win32Exception End Try End Sub Private Sub openToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcTSm.Click, DosyaAçTSmn.Click ListView1_DoubleClick(sender, e) End Sub Private Sub openLocationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DsyKlsAcTsm.Click, DsyKlsAçTsmn.Click Process.Start(SonCalDsyKlasoru) End Sub Private Sub TumSilTsm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TumSilTsm.Click For Each TumCalDsy In Directory.GetFiles(SonCalDsyKlasoru) File.Delete(TumCalDsy) Next ListView1.Items.Clear() End Sub Dim DosyaSil As String Private Sub SecilSilTsm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SecilSilTsm.Click For Each selected In ListView1.SelectedItems DosyaSil = selected.ToString.Remove(0, selected.ToString.IndexOf("{") + 1).Replace("}", "") File.Delete(DosyaSil) ListView1.Items.RemoveByKey(DosyaSil) Next End Sub Private Sub SilTsm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SilTsm.Click File.Delete(ListView1.SelectedItems(0).Text) ListView1.Items.RemoveByKey(ListView1.SelectedItems(0).Text) End Sub Private Sub ListView1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDown If e.Button = Windows.Forms.MouseButtons.Right Then If (ListView1.SelectedItems.Count > 0) Then 'contextMenuStrip3.Show(ListView1, 0, -50) contextMenuStrip1.Show(ListView1, ListView1.SelectedItems(0).Position.X + 20, ListView1.SelectedItems(0).Position.Y + 20) End If End If End Sub Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged Dim sayi As Integer = ListView1.Items.Count Dim eleman As ListViewItem For i As Integer = 0 To sayi - 1 eleman = ListView1.Items(i) If eleman.Selected Then Label1.Text = ListView1.Items(i).SubItems(0).Text TextBox1.Text = ListView1.Items(i).SubItems(2).Text End If Next End Sub #Region " ESC İLE KAPATMA, DELETE İLE SATIR SİLME...." Private Sub ListView1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles ListView1.KeyDown If e.KeyCode = Keys.Delete Then Call ListedenSatırSil() End If If e.KeyCode = Keys.Escape Then Me.Close() End If End Sub Public Sub ListedenSatırSil() On Error Resume Next Dim indeksler As ListView.SelectedIndexCollection = ListView1.SelectedIndices Dim index As Integer TextBox1.Text = Nothing For Each index In indeksler ListView1.Items.RemoveAt(index) Next If index = 0 Then index = 0 index = index - 1 If index = -1 Then index = 0 eleman = ListView1.Items(index) eleman.Selected = True ListView1.Focus() End Sub #End Region Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim yol As String = Application.StartupPath & "\zzz" Try For Each file As IO.FileInfo In New IO.DirectoryInfo(yol).GetFiles("*.txt") If (Now - file.CreationTime).Days < 7 Then file.Delete() Next MsgBox(yol & " *.TXT Dosyaları silindi") Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub End Class
Hiç yorum yok:
Yorum Gönder
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder