on 08-30-2006 1:46 PM
Hi friends,
I have desigend a form which contains a button.If click that button , i want to get the <b>Open file dialog box (Windows form )</b> .
If i select the file I want to get the path of that file in editBox.
Expecting ur reply soon.
Thanks
SARAN
Hi, Saran
You have to try this code,
First Add the Window Wrapper Class:
Public Class WindowWrapper
Implements System.Windows.Forms.IWin32Window
Private _hwnd As IntPtr
Public Sub New(ByVal handle As IntPtr)
_hwnd = handle
End Sub
Public ReadOnly Property Handle() As System.IntPtr Implements System.Windows.Forms.IWin32Window.Handle
Get
Return _hwnd
End Get
End Property
End Class
and call this function as Item_Click Event
Private Sub fillopen()
Dim mythr As New System.Threading.Thread(AddressOf ShowFileDialog)
mythr.SetApartmentState(Threading.ApartmentState.STA)
mythr.Start()
mythr.Join()
End Sub
Private Sub ShowFileDialog()
Dim oDialogBox As New OpenFileDialog
Dim strFileName, strMdbFilePath As String
Dim oEdit As SAPbouiCOM.EditText
Dim oProcesses() As Process
Try
'Form.Freeze(True)
oProcesses = Process.GetProcessesByName("SAP Business One")
If oProcesses.Length <> 0 Then
For i As Integer = 0 To oProcesses.Length - 1
Dim MyWindow As New WindowWrapper(oProcesses(i).MainWindowHandle)
If oDialogBox.ShowDialog(MyWindow) = DialogResult.OK Then
strMdbFilePath = oDialogBox.FileName
strSelectedFilepath = oDialogBox.FileName
Else
End If
Next
End If
Catch ex As Exception
objAddon.objApplication.MessageBox(ex.Message)
Finally
End Try
End Sub
Its Working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear All,
You may download a source code in VB and C# from the following link:
It was created by 2004 version several years before, but it is still working, and supports Terminal servers mode also.
Regadrs
János
Hi Saran,
can you let me know if you have got any solution to the file open problem you had..??
Thank you,
Srikanth
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.
- you catch the button event
- in the event handler you open the open file dialog box
- you return the control to B1
if you need to get the file path you read it from the
edit box
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi SRJJ.
You need to do this.
include a reference in your VB.NET Project
System.Windows.Forms
then
Dim loOFD As System.Windows.Forms.OpenFileDialog
Dim loEditText as SAPbouiCOM.EditText
loOFD = New System.Windows.Forms.OpenFileDialog
loOFD.ShowDialog()
loEditText = SBOApplication.Forms.Item(FormUID)
loEditText.String = loOFD.FileName
loEditText.Update
It´s All
Bye i will suppose that you give me some points jejejejej
=...(
bye
hi Elias Lora Guerra ,
Thanks for your reply.
i tryed with your code.
now i am getting the file path in text box---but <b><u>when i click the button the open file dialog box will display at desktop ,not in the SBO form.</u></b>if i select file then it shows in text box.
now i will save that record.if next time i will open the same record and <b>click on the path of file(in textbox)it directly opens the file</b> Like (humanresources>employee master data>attachments tab--->browse button
if u open any old record and click on the file path on path column it directly.
EXPECTING YOUR REPLY SOON
Thanks
SARAN
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.