cancel
Showing results for 
Search instead for 
Did you mean: 

OpenFileDialog Focus Problem

Former Member
0 Kudos

When making a functionally attachment in my Add-on, sometimes using the property of the OpenFileDialog C #, the dialog box that appears to select files is behind the screen of the sap. That is, it loses focus. How to do this by setting it as the main focus in sap? Here my code:

ThreadStart starter = delegate { Anexar(oEditItem); };

Thread t = new Thread(starter);

t.SetApartmentState(ApartmentState.STA);

t.Start();

t.Join();

public void Anexar(SAPbouiCOM.EditText oEditItem)

{

try

{

OpenFileDialog fDialog = new OpenFileDialog();

fDialog.Title = "Anexar arquivo";

fDialog.Filter = "(.)|.";

fDialog.InitialDirectory = @"C:\";

if (fDialog.ShowDialog() == DialogResult.OK)

{

oEditItem.Value = fDialog.FileName.ToString();

}

}

catch (Exception e)

{

SBO_Application.MessageBox(e.Message);

}

}

Accepted Solutions (1)

Accepted Solutions (1)

former_member689126
Active Contributor
0 Kudos

Hi

check these threads

Regards

Arun

Answers (0)