on 08-20-2009 3:51 PM
Hi
I have my own form on screen with a edit text box which will contain the path and name of a file entered by the user
Is there any way I can display the windows open file dialogue so the user can search for a file ?
Many thanks
Regards Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andy,
This suggestion (from Denis Sapunkov) seems to work quite well:
We are using sth similar in Custom Help Mapping - source code available here (file: Button__SAP_CustomHelpMap__SAP_CHPATH.cs):
HTH,
Frank
Reopnened as using the link solution always copies file to attachment folder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anoop
Sorry for the delay as I thought the solution using a SAP link udf would work, which it does but it always copies the file to the attachment folder
Just tried your solution but I am getting the following message -
Current thread must be set to single thread appartment (STA) mode
Any ideas please ?
Copy of my vb code below -
abform = New Form1
abform.Show()
abform.ShowReportMainFunction()
Dim openfiledialog1 As New Windows.Forms.OpenFileDialog
openfiledialog1.ShowDialog()
Dim callFunction As Windows.Forms.MethodInvoker = New Windows.Forms.MethodInvoker(AddressOf ShowReport) 'ERROR HERE
'In the ShowReport Function
Public Sub ShowReport()
Me.OpenFileDialog1.ShowDialog()
End Sub
'Main function to Invoke the MethodInvoker
Public Sub ShowReportMainFunction()
Me.BeginInvoke(callFunction)
End Sub
Regards Andy
Hi Anoop
Code below, simple and it seems to work well
Thanks for your help
Regards Andy
fpath = ""
Dim thread As New System.Threading.Thread(AddressOf openfile)
thread.SetApartmentState(Threading.ApartmentState.STA)
thread.Start()
thread.Join()
form.Items.Item("4").Specific.string = fpath
Sub openfile()
Dim abform As Form1
abform = New Form1
abform.Show()
abform.OpenFileDialog1.Filter = "CSV Files|*.csv"
If abform.OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
fpath = abform.OpenFileDialog1.FileName
End If
abform.Close()
End Sub
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.