Imports System.ComponentModel Imports System.IO Imports System.Runtime.InteropServices Imports DevExpress.Utils Imports DevExpress.XtraGrid Imports DevExpress.XtraGrid.Columns Imports DevExpress.XtraGrid.Views.Grid Imports DD_LIB_Standards Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraTab Public Class frmResultDoc Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean End Function Public Structure SHELLEXECUTEINFO Public cbSize As Integer Public fMask As Integer Public hwnd As IntPtr Public lpVerb As String Public lpFile As String Public lpParameters As String Public lpDirectory As String Dim nShow As Integer Dim hInstApp As IntPtr Dim lpIDList As IntPtr Public lpClass As String Public hkeyClass As IntPtr Public dwHotKey As Integer Public hIcon As IntPtr Public hProcess As IntPtr End Structure #Region "Laufzeitvariablen & Konstanten" Private Const SEE_MASK_INVOKEIDLIST = &HC Private Const SEE_MASK_NOCLOSEPROCESS = &H40 Private Const SEE_MASK_FLAG_NO_UI = &H400 Public Const SW_SHOW As Short = 5 Private Shared BW_DocPath As String Private Shared BW_DocID As Integer Private Shared CurrSearchID As Integer Private DTDocSearchDefinition As DataTable Private _frmDocView As frmDocView 'You need a reference to Form1 Private _frmProfileMatch As frmDocView 'You need a reference to Form1 Private _activeGridView As GridView #End Region Public Sub New() MyBase.New ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. _frmDocView = frmDocView End Sub Sub RefreshTabDoc(PROFILE_ID As Integer, ConID As Integer, SQLCommand As String, TabIndex As Integer, TabCaption As String) Try SQLCommand = clsPatterns.ReplaceAllValues(SQLCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, PROFILE_ID) Dim myGridControl As DevExpress.XtraGrid.GridControl Dim myGridview As DevExpress.XtraGrid.Views.Grid.GridView Select Case TabIndex Case 0 GridControlDocSearch1.DataSource = Nothing GridViewDocSearch1.Columns.Clear() myGridview = GridViewDocSearch1 myGridControl = GridControlDocSearch1 Case 1 GridControlDocSearch2.DataSource = Nothing GridViewDocSearch2.Columns.Clear() myGridview = GridViewDocSearch2 myGridControl = GridControlDocSearch2 Case 2 GridControlDocSearch3.DataSource = Nothing GridViewDocSearch3.Columns.Clear() myGridview = GridViewDocSearch3 myGridControl = GridControlDocSearch3 Case 3 GridControlDocSearch4.DataSource = Nothing GridViewDocSearch4.Columns.Clear() myGridControl = GridControlDocSearch4 myGridview = GridViewDocSearch4 Case 4 GridControlDocSearch5.DataSource = Nothing GridViewDocSearch5.Columns.Clear() myGridControl = GridControlDocSearch5 myGridview = GridViewDocSearch5 End Select myGridControl.ContextMenuStrip = ContextMenuStripWMFile Dim oDatatable As DataTable = clsDatabase.Return_Datatable(SQLCommand) If Not IsNothing(oDatatable) Then XtraTabControlDocs.TabPages(TabIndex).Text = $"{TabCaption} ({oDatatable.Rows.Count})" clsWMDocGrid.DTDocuments = oDatatable 'Select Case TabIndex ' Case 0 ' GridControlDocSearch1.DataSource = oDatatable ' Case 1 ' GridControlDocSearch2.DataSource = oDatatable ' Case 2 ' GridControlDocSearch3.DataSource = oDatatable ' Case 3 ' GridControlDocSearch4.DataSource = oDatatable ' Case 4 ' GridControlDocSearch5.DataSource = oDatatable 'End Select Create_GridControl(myGridview, oDatatable) Dim oxmlPath As String = "" oxmlPath = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex) If File.Exists(oxmlPath) Then myGridview.RestoreLayoutFromXml(oxmlPath) myGridview.GuessAutoFilterRowValuesFromFilter() End If tslblState.Text = $"Tab [{TabCaption}] refreshed - {Now}" XtraTabControlDocs.TabPages(TabIndex).PageVisible = True Else clsWMDocGrid.DTDocuments = Nothing End If Catch ex As Exception Logger.Error(ex) End Try End Sub Private Function Create_GridControl(MyGridView As GridView, _datatable As DataTable) As GridView Dim oMyDocDatatable As New DataTable Try 'Die Icon Colum erstellen und konfigurieren Dim oColIcon As New System.Data.DataColumn() oColIcon.DataType = GetType(Image) oColIcon.ColumnName = "ICON" oColIcon.Caption = "" oMyDocDatatable.Columns.Add(oColIcon) Dim oColPath As New System.Data.DataColumn() oColPath.DataType = GetType(String) oColPath.ColumnName = "FULL_FILENAME" oColPath.Caption = "Fullpath" oMyDocDatatable.Columns.Add(oColPath) Dim oColDocID As New System.Data.DataColumn() oColDocID.DataType = GetType(Int32) oColDocID.ColumnName = "DocID" oColDocID.Caption = "DocID" oMyDocDatatable.Columns.Add(oColDocID) Dim oRestColArray As New List(Of String) For Each oCol As DataColumn In _datatable.Columns Dim onewColumn As New System.Data.DataColumn() If oCol.ColumnName <> "DocID" And oCol.ColumnName <> "FULL_FILENAME" And oCol.ColumnName <> "Filename" Then onewColumn.DataType = GetType(String) onewColumn.ColumnName = oCol.ColumnName onewColumn.Caption = oCol.Caption oMyDocDatatable.Columns.Add(onewColumn) oRestColArray.Add(onewColumn.ColumnName) End If Next For Each FILE_ROW As DataRow In _datatable.Rows Dim oFullpath = FILE_ROW.Item("FULL_FILENAME") Dim oDocID = FILE_ROW.Item("DocID") 'Dim Folderpath = Path.GetDirectoryName(fullpath) Dim oFilename = Path.GetFileName(oFullpath) Dim oFileextension = Path.GetExtension(oFullpath) Dim oNewRow As DataRow oNewRow = oMyDocDatatable.NewRow() 'Icon zuweisen Select Case oFileextension.ToUpper Case ".csv".ToUpper oNewRow.Item(0) = My.Resources.doc_excel_csv Case ".txt".ToUpper oNewRow.Item(0) = My.Resources.txt Case ".pdf".ToUpper oNewRow.Item(0) = My.Resources.pdf Case ".doc".ToUpper oNewRow.Item(0) = My.Resources.doc Case ".docx".ToUpper oNewRow.Item(0) = My.Resources.doc Case ".xls".ToUpper oNewRow.Item(0) = My.Resources.xls Case ".xlsx".ToUpper oNewRow.Item(0) = My.Resources.xls Case ".xlsm".ToUpper oNewRow.Item(0) = My.Resources.xls Case ".ppt".ToUpper oNewRow.Item(0) = My.Resources.ppt Case ".pptx".ToUpper oNewRow.Item(0) = My.Resources.ppt Case ".dwg".ToUpper oNewRow.Item(0) = My.Resources.dwg Case ".dxf".ToUpper oNewRow.Item(0) = My.Resources.dxf Case ".msg".ToUpper oNewRow.Item(0) = My.Resources.email_go Case ".msg".ToUpper oNewRow.Item(0) = My.Resources.email_go Case ".tif".ToUpper oNewRow.Item(0) = My.Resources.tiff Case ".tiff".ToUpper oNewRow.Item(0) = My.Resources.tiff Case ".jpg".ToUpper oNewRow.Item(0) = My.Resources.jpg Case Else oNewRow.Item(0) = My.Resources._blank End Select 'Den Filepath mitgeben oNewRow.Item(1) = oFullpath oNewRow.Item(2) = oDocID Dim i = 3 'Fängt bei 3 an, um die definierten Spalten zu überspringen For Each Colname As String In oRestColArray Dim oRowValue oRowValue = FILE_ROW.Item(Colname) oNewRow.Item(i) = oRowValue.ToString i += 1 Next oMyDocDatatable.Rows.Add(oNewRow) Next Dim sdsd As String = "" Dim oGridControl As GridControl = MyGridView.GridControl oGridControl.DataSource = oMyDocDatatable oGridControl.ForceInitialize() Try MyGridView.Columns.Item("DocID").Visible = False Catch ex As Exception End Try Try MyGridView.Columns.Item("FULL_FILENAME").Visible = False Catch ex As Exception End Try Dim created, changed As String If USER_LANGUAGE <> "de-DE" Then changed = "Changed" created = "Created" Else changed = "Geändert" created = "Erstellt" End If Dim createdColumn = MyGridView.Columns(created) If Not IsNothing(createdColumn) Then createdColumn.DisplayFormat.FormatType = FormatType.DateTime createdColumn.DisplayFormat.FormatString = USER_DATE_FORMAT & " HH:MM:ss" End If Dim changedColumn = MyGridView.Columns(changed) If Not IsNothing(changedColumn) Then changedColumn.DisplayFormat.FormatType = FormatType.DateTime changedColumn.DisplayFormat.FormatString = USER_DATE_FORMAT & " HH:MM:ss" End If ' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt For Each column As GridColumn In MyGridView.Columns column.OptionsColumn.AllowEdit = False Next MyGridView.Columns.Item("ICON").MaxWidth = 24 MyGridView.Columns.Item("ICON").MinWidth = 24 MyGridView.OptionsView.BestFitMaxRowCount = -1 MyGridView.BestFitColumns(True) Return MyGridView Catch ex As Exception Logger.Error(ex) End Try End Function Private Function Get_DocGrid_Layout_Filename(oIndex As Integer) Dim oFilename As String = String.Format("GridViewDoc_Search-{0}-{1}-UserLayout.xml", oIndex, CurrSearchID) Dim oPath = System.IO.Path.Combine(Application.UserAppDataPath(), oFilename) Return oPath End Function Private Sub GridControlDocSearch_Leave(sender As Object, e As EventArgs) Handles GridControlDocSearch1.Leave, GridControlDocSearch2.Leave, GridControlDocSearch3.Leave, GridControlDocSearch4.Leave, GridControlDocSearch5.Leave SaveDocGridLayout() End Sub Sub SaveDocGridLayout() Dim oXMLPath = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex) clsWMDocGrid.ActiveDocGrid.SaveLayoutToXml(oXMLPath) End Sub Private Sub EigenschaftenDateiToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenDateiToolStripMenuItem.Click Show_File_Properties() End Sub Sub Show_File_Properties() If IsNothing(clsWMDocGrid.DTDocuments) Then MsgBox("Could not read file Parameters!", MsgBoxStyle.Exclamation) Exit Sub End If For Each oRow As DataRow In clsWMDocGrid.DTDocuments.Rows If oRow.Item("DOC_PATH") <> "" Then Cursor = Cursors.WaitCursor Dim sei As New SHELLEXECUTEINFO sei.cbSize = Marshal.SizeOf(sei) sei.lpVerb = "properties" sei.lpFile = oRow.Item("DOC_PATH") sei.nShow = SW_SHOW sei.fMask = SEE_MASK_INVOKEIDLIST If Not ShellExecuteEx(sei) Then Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error()) MsgBox("Error in Open file propertys: " & ex.Message, MsgBoxStyle.Critical) Logger.Error(ex) End If End If Cursor = Cursors.Default Next End Sub Private Sub DateiÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiÖffnenToolStripMenuItem.Click FileShow() End Sub Sub FileShow() Try If IsNothing(clsWMDocGrid.DTDocuments) Then MsgBox("Could not read fileparameters(5)!", MsgBoxStyle.Exclamation) Exit Sub End If For Each row As DataRow In clsWMDocGrid.DTDocuments.Rows File_SYSOPEN(row.Item("DOC_PATH"), row.Item("DOC_ID")) Next Catch ex As Exception End Try End Sub Private Shared Sub File_SYSOPEN(RESULT_DOC_PATH As Object, DocID As String) Try If RESULT_DOC_PATH <> Nothing Then BW_DocPath = RESULT_DOC_PATH BW_DocID = DocID Dim BWFileHandler As New BackgroundWorker AddHandler BWFileHandler.DoWork, AddressOf BWFileHandler_DoWork BWFileHandler.RunWorkerAsync() End If Catch ex As Exception MsgBox("Unexpected Error in File_SYSOPEN:" & vbNewLine & ex.Message & vbNewLine & RESULT_DOC_PATH & vbNewLine & "DocID: " & DocID, MsgBoxStyle.Critical) Logger.Error(ex) End Try End Sub Private Shared Sub BWFileHandler_DoWork() Try Dim oMyProcess = New Process() Dim oExtension Dim oSql Try 'Dim oPSI As New ProcessStartInfo(BW_DocPath) oMyProcess.StartInfo.FileName = BW_DocPath oMyProcess.StartInfo.UseShellExecute = True oMyProcess.StartInfo.RedirectStandardOutput = False oMyProcess.Start() 'oMyProcess.WaitForExit() Catch ex As Exception Logger.Error(ex) Exit Sub End Try Catch ex As Exception Logger.Error(ex) Try Process.Start(BW_DocPath) Catch ex1 As Exception Logger.Error(ex) End Try End Try End Sub Sub Refresh_DocID(myGrid As GridView) _activeGridView = myGrid clsWMDocGrid.ActiveDocGrid = myGrid clsWMDocGrid.ActiveDocGrid.EndSelection() clsWMDocGrid.GetDocItems() Try ContextMenuStripWMFile.Close() Catch ex As Exception End Try If ToolStripDropDownButtonFile.Visible = False Then ToolStripDropDownButtonFile.Visible = True End If If clsWMDocGrid.SELECTED_DOC_ID <> 0 Then Dim msg = "Doc-ID: " & clsWMDocGrid.SELECTED_DOC_ID.ToString tslblDocID.Text = msg ToolStripDropDownButtonFile.Enabled = True Dim frmCollection As New FormCollection() frmCollection = Application.OpenForms() Try If frmCollection.Item("frmDocView").IsHandleCreated Then 'MsgBox("Yes Opened") _frmDocView.Load_File_from_Path(clsWMDocGrid.SELECTED_DOC_PATH) Else Dim f As New frmDocView With f .Show() .Load_File_from_Path(clsWMDocGrid.SELECTED_DOC_PATH) End With End If Catch ex As Exception Dim newDocView As New frmDocView With newDocView .Show() .Load_File_from_Path(clsWMDocGrid.SELECTED_DOC_PATH) End With _frmDocView = newDocView End Try Me.BringToFront() Else tslblDocID.Text = "DocRow not selected" ToolStripDropDownButtonFile.Enabled = False End If End Sub Private Sub GridViewDocSearch1_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridViewDocSearch1.FocusedRowChanged _activeGridView = GridViewDocSearch1 Refresh_DocID(GridViewDocSearch1) End Sub Private Sub GridViewDocSearch1_ColumnWidthChanged(sender As Object, e As Views.Base.ColumnEventArgs) Handles GridViewDocSearch1.ColumnWidthChanged _activeGridView = GridViewDocSearch1 SaveDocGridLayout() End Sub Private Sub ÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ÖffnenToolStripMenuItem.Click FileShow() End Sub Private Sub EigenschaftenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenToolStripMenuItem.Click Show_File_Properties() End Sub Private Sub frmResultDoc_Load(sender As Object, e As EventArgs) Handles Me.Load ToolStripDropDownButtonFile.Visible = False If My.Settings.frmResultDocPosition.IsEmpty = False Then If My.Settings.frmResultDocPosition.X > 0 And My.Settings.frmResultDocPosition.Y > 0 Then Location = My.Settings.frmResultDocPosition End If End If If My.Settings.frmResultDocSize.IsEmpty = False Then Size = My.Settings.frmResultDocSize End If Load_Searches() End Sub Sub Load_Searches() If Not IsNothing(CurrSearch2Load) Then Dim oSQL = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({CurrSearch2Load}) ORDER BY TAB_INDEX" DTDocSearchDefinition = clsDatabase.Return_Datatable(oSQL) Dim oindex As Integer Dim ocounter As Integer = 0 If CurrSearch2Load.ToString.Contains(",") Then End If For Each oRow As DataRow In DTDocSearchDefinition.Rows RefreshTabDoc(oRow.Item("PROFILE_ID"), oRow.Item("CONN_ID"), oRow.Item("SQL_COMMAND"), ocounter, oRow.Item("TAB_TITLE")) ocounter += 1 Next Else MsgBox("Sorry but the selection of profile went wrong. (CurrSearch2Load is nothing)", MsgBoxStyle.Critical) Me.Close() End If End Sub Private Sub frmResultDoc_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing Try ' Position und Größe speichern My.Settings.frmResultDocSize = Me.Size My.Settings.frmResultDocPosition = Me.Location My.Settings.Save() Catch ex As Exception Logger.Error(ex) Logger.Info("Error in Save FormLayout: " & ex.Message) End Try Try Dim frmCollection As New FormCollection() frmCollection = Application.OpenForms() If frmCollection.Item("frmDocView").IsHandleCreated Then _frmDocView.Close() End If If frmCollection.Item("frmProfileMatch").IsHandleCreated Then frmProfileMatch.Show() frmProfileMatch.BringToFront() End If Catch ex As Exception End Try End Sub Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click ReLoad_Active_DocTab() End Sub Private Sub ToolStripMenuItem2_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem2.Click Set_DoclayoutBack() End Sub Sub Set_DoclayoutBack() Dim oXMLPath = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex) Try If File.Exists(oXMLPath) Then File.Delete(oXMLPath) ReLoad_Active_DocTab() tslblState.Text = "Layout has been set back!" Else tslblState.Text = "" End If Catch ex As Exception tslblState.Text = "" End Try End Sub Sub ReLoad_Active_DocTab() Dim oTabIndex = XtraTabControlDocs.SelectedTabPageIndex Dim oConID = DTDocSearchDefinition.Rows(oTabIndex).Item("CONN_ID") Dim oCommand = DTDocSearchDefinition.Rows(oTabIndex).Item("SQL_COMMAND") Dim oProfID = DTDocSearchDefinition.Rows(oTabIndex).Item("PROFILE_ID") oCommand = clsPatterns.ReplaceAllValues(oCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfID) RefreshTabDoc(oProfID, oConID, oCommand, oTabIndex, DTDocSearchDefinition.Rows(oTabIndex).Item("TAB_TITLE")) End Sub Private Sub GridViewDocSearch1_FocusedColumnChanged(sender As Object, e As Views.Base.FocusedColumnChangedEventArgs) Handles GridViewDocSearch1.FocusedColumnChanged _activeGridView = GridViewDocSearch1 Refresh_DocID(GridViewDocSearch1) End Sub Private Sub GridViewDocSearch2_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch2.FocusedColumnChanged _activeGridView = GridViewDocSearch2 Refresh_DocID(GridViewDocSearch2) End Sub Private Sub GridViewDocSearch3_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch3.FocusedColumnChanged _activeGridView = GridViewDocSearch3 Refresh_DocID(GridViewDocSearch3) End Sub Private Sub GridViewDocSearch4_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch4.FocusedColumnChanged _activeGridView = GridViewDocSearch4 Refresh_DocID(GridViewDocSearch4) End Sub Private Sub GridViewDocSearch5_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch5.FocusedColumnChanged _activeGridView = GridViewDocSearch5 Refresh_DocID(GridViewDocSearch5) End Sub Private Sub GridViewDocSearch2_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch2.FocusedRowChanged _activeGridView = GridViewDocSearch2 Refresh_DocID(GridViewDocSearch2) End Sub Private Sub GridViewDocSearch3_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch3.FocusedRowChanged _activeGridView = GridViewDocSearch3 Refresh_DocID(GridViewDocSearch3) End Sub Private Sub GridViewDocSearch4_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch4.FocusedRowChanged _activeGridView = GridViewDocSearch4 Refresh_DocID(GridViewDocSearch4) End Sub Private Sub GridViewDocSearch5_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch5.FocusedRowChanged _activeGridView = GridViewDocSearch5 Refresh_DocID(GridViewDocSearch5) End Sub Private Sub frmResultDoc_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown End Sub Private Sub XtraTabControlDocs_TabIndexChanged(sender As Object, e As EventArgs) Handles XtraTabControlDocs.TabIndexChanged End Sub Private Sub XtraTabControlDocs_SelectedPageChanged(sender As Object, e As TabPageChangedEventArgs) Handles XtraTabControlDocs.SelectedPageChanged If IsNothing(DTDocSearchDefinition) Then Exit Sub Dim oConID = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("CONN_ID") Dim oCommand = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("SQL_COMMAND") Dim oProfileID = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("PROFILE_ID") oCommand = clsPatterns.ReplaceAllValues(oCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileID) Dim oTabIndex = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("TAB_INDEX") Dim oTabCaption = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("TAB_TITLE") RefreshTabDoc(oProfileID, oConID, oCommand, oTabIndex, oTabCaption) End Sub Private Sub GridControlDocSearch1_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch1.DoubleClick Refresh_DocID(GridViewDocSearch1) FileShow() End Sub Private Sub GridControlDocSearch2_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch2.DoubleClick Refresh_DocID(GridViewDocSearch2) FileShow() End Sub Private Sub GridControlDocSearch3_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch3.DoubleClick Refresh_DocID(GridViewDocSearch3) FileShow() End Sub Private Sub GridControlDocSearch4_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch4.DoubleClick Refresh_DocID(GridViewDocSearch4) FileShow() End Sub Private Sub GridControlDocSearch5_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch5.DoubleClick Refresh_DocID(GridViewDocSearch5) FileShow() End Sub Private Sub OrdnerÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OrdnerÖffnenToolStripMenuItem.Click Open_Folder() End Sub Sub Open_Folder() Dim oFilepath = Path.GetDirectoryName(clsWMDocGrid.SELECTED_DOC_PATH) If System.IO.Directory.Exists(oFilepath) = True Then Process.Start(oFilepath) Else MsgBox("Folder '" & oFilepath & "' not existing or accessible!", MsgBoxStyle.Exclamation) End If End Sub End Class