Focus not changing to called Input Box RRS feed

  • Question

  • Hi All.

    Firstly, I would like to mention that I usually create my add-ins in VBA but I am currently converting them to C# so i am a C# noob . I am currently writing a VSTO add-in which requires the user to select the first cell in the range. I am currently using the inputbox method which is called from a windows form, but when I call the method the input box does not become the active object i have hidden the windows form that calls the input box. This issue leads me to have to use alt + tab to activate the input box. This works fine for me but once I deploy to others they may get confused. Is there a way to ensure when the input box is called from the windows form that it becomes the active focus? I have included the code snippet below:

    Thank you all in advance.

     private void Btn_FormGL_Ok_Click(object sender, EventArgs e)
                Excel.Application App = Globals.ThisAddIn.Application;
                Excel.Worksheet ActSheet = App.ActiveSheet;
                this.Visible = false;
                //Get first cell from user
                Excel.Range MyRange = App.InputBox("Select first cell with data", "Select First Cell",
                Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 8);


    I have resolved this issue by changing my call to the form in the ribbon from form,ShowDialog() to Form.Show.

    • Edited by Madhog85 Monday, September 23, 2019 1:16 PM
    Friday, September 6, 2019 9:32 AM