Skip to Content
0
Former Member
Dec 08, 2011 at 02:15 AM

[HELP]SDK UI OpenFileDialog

339 Views

I think the error is in the ShowDialog() Please help

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

        Dim oPdbox As New OpenFileDialog

        Try
            If FormUID = "MySimpleForm" Then

                Select Case pVal.ItemUID
                    Case "Browse"
                        Select Case pVal.EventType
                            Case SAPbouiCOM.BoEventTypes.et_CLICK
                                If pVal.Before_Action = False Then
                                    oPdbox.Title = "Test"
                                    oPdbox.Filter = "All Files(*.xlsx)|*.xlsx|All Files(*.xls)|*.xls"
                                    oPdbox.FilterIndex = 1

                                    *oPdbox.ShowDialog()*
                                End If
                        End Select
                End Select

            End If

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

Having problem with OpenDialog.

Current thread must be set to single thread apartment (STA) mode before OLE  
  
calls can be made. Ensure that your Main function has STAThreadAttribute  
  
marked on it. This exception is only raised if a debugger is attached to the  
  
process.

I'm new with SDK of SAP B1

Edited by: hikaru1207 on Dec 8, 2011 4:23 AM