Imports System.IO Imports SDL Public Class frmGenerelleGestellungen Dim pathGG = "\\192.168.0.91\f\VERAG Vorlagen Quickstop\Generelle Gestellungen\" ' Dim cDATENSERVER As New VERAG_PROG_ALLGEMEIN.cDATENSERVER Private Sub txtSuchen_TextChanged(sender As Object, e As EventArgs) Handles txtSuchen.TextChanged Dim search = sender.text DataGridView.Rows.Clear() If search.length < 2 Then Exit Sub ' For Each f In System.IO.FileStream("Y:\VERAG Vorlagen Quickstop\Generelle Gestellungen\") For Each dir As String In IO.Directory.GetDirectories(pathGG) ' Ermittelt alle Unterordner des Ordners For Each file As String In IO.Directory.GetFiles(dir) ' Ermittelt alle Dateien des Ordners If cut_file(file).ToUpper.StartsWith(search.ToUpper) Then Dim FI As New IO.FileInfo(file) Dim LastWriteDate As Date = FI.LastWriteTime DataGridView.Rows.Add(cut_file(file), FI.LastWriteTime, CInt(FI.Length / 1000) & " KB", file) 'MsgBox(cut_file(file)) End If 'IO.File.Copy(file, AppDomain.CurrentDomain.BaseDirectory & cut_file(file), True) ' Kopiert die Dateien Next Next ' For Each file As String In IO.Directory.GetDirectories(f) ' Ermittelt alle Unterordner des Ordners 'My.Computer.FileSystem.CopyDirectory(file, AppDomain.CurrentDomain.BaseDirectory & cut_file(file), True) Next End Sub Private Function cut_file(ByVal file As String) As String ' Funktion zum Entfernen der Backslashs / Ordner While file.Contains("\") file = file.Remove(0, 1) End While Return file End Function While file.Contains("\") file = file.Remove(0, 1) End While Return file End Function Private Sub DataGridView_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView.CellDoubleClick If DataGridView.SelectedRows.Count > 0 Then 'cDATENSERVER.openDataTMP(DataGridView.SelectedRows(0).Cells("path").Value) VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.OPEN_PATH(DataGridView.SelectedRows(0).Cells("path").Value) End If End Sub Dim cFormularManager As New VERAG_PROG_ALLGEMEIN.cFormularManager Private Sub btnT1T2_Click(sender As Object, e As EventArgs) Handles btnT1T2.Click cFormularManager.fillGestellungsGarantie(-1, "DE") End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click cFormularManager.fillGestellungsGarantie(-1, "EN") End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click cFormularManager.fillGestellungsGarantie(-1, "FR") End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click cFormularManager.fillGestellungsGarantie(-1, "NL") End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Dim fd As New OpenFileDialog fd.Filter = "PDF Dateien|*.pdf;" If fd.ShowDialog() = DialogResult.OK Then If Not fd.FileName.EndsWith(".pdf") And Not fd.FileName.EndsWith(".PDF") Then Me.Cursor = Cursors.Default MsgBox("Falsches Format, bitte .PDF-Datei auswählen!") Exit Sub End If Dim path = "" Dim value As String = "" value = InputBox("Bitte geben Sie einen Namen für das Dokument ein:", "File - Name", System.IO.Path.GetFileName(fd.FileName), 200, 100) If Not value.ToUpper.EndsWith(".PDF") Then value &= ".pdf" If value.Chars(0) = "S" Then If value.ToUpper.StartsWith("SCH") Then : path = "\\192.168.0.91\f\VERAG Vorlagen Quickstop\Generelle Gestellungen\SCH\" ElseIf value.Chars(0) = "ST" Then : path = "\\192.168.0.91\f\VERAG Vorlagen Quickstop\Generelle Gestellungen\ST\" Else : path = "\\192.168.0.91\f\VERAG Vorlagen Quickstop\Generelle Gestellungen\S\" End If Else path = "\\192.168.0.91\f\VERAG Vorlagen Quickstop\Generelle Gestellungen\" & value.Chars(0) & "\" End If If Not System.IO.Directory.Exists(path) Then System.IO.Directory.CreateDirectory(path) End If System.IO.File.Copy(fd.FileName, path & value) End If Me.Cursor = Cursors.Default End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click If DataGridView.SelectedRows.Count = 1 Then If vbYes = MsgBox("Möchten Sie die Datei wirklich löschen?:" & vbNewLine & vbNewLine & DataGridView.SelectedRows(0).Cells("path").Value, vbYesNoCancel) Then System.IO.File.Delete(DataGridView.SelectedRows(0).Cells("path").Value) txtSuchen.Text = "" End If End If End Sub End Class