Word Addin: TabPage does not draw child on tab change RRS feed

  • Question

  • I have a Word add-in (VS2013/2015 + VSTO, C#) that provides a side panel in Word. In the panel is a TabControl with four TabPage controls. Each TabPage has a few Buttons + a TextBox. For whatever reason ... this week the TabPage controls stopped drawing the TextBox controls except for the first visible TabPage - basically, the TextBox controls are not drawn when switching tabs. If I make the first tab visible on startup, that textbox shows for the run. Every other tab fails. But ... if I set the second tab as "show first on startup", and then start Word ... THAT tab/textbox shows, and all the others fail. And so on. 

    To make things worse, if I just start a new VS project with a couple tabpages + textboxes, everything seems fine. If I copy/paste my designer template into a new project, that works, too. But ... my original project is broken.  I actually wasn't even working on this code at all in the past ten days - I only found out because I started up Word and my tabs/textboxes were broken! I suspect it has something to do with a system/.NET update, but I haven't been able to track down what update would have done this =(

    I've checked layouts, parents, the TabPage.Controls list ... the only thing out of place is that the parent TabPage can't find the child TextBox using GetChildAtPoint(). I have no idea why the TextBox is a valid child, it has a valid location (4, 29), but it can't be found by GetChildAtPoint(). The TextBox is still in the TabPage.Controls list, but I can't find the control anywhere using TabPage.GetChildAtPoint() - I've searched up to +/- 1000px each side of the TabPage dimensions.

    Other things I've tried:

    * re-adding the TextBox to the TabPage (both live and via the Designer)

    * moving the TextBox inside the TabPage (both live and through the Designer)

    * Invalidate/redraw both TabPage + TextBox (live)

    * building on both VS2013 and VS2015 ... on two different machines ... both produce a DLL/binary with the same bug.

    * digging through & testing old builds - evidently the bug is in my code/project, and it's been around at least since my first release (about 2 years ago)

    * changing Z-order of the TextBox using GetIndex/SetIndex ... 

    I'm really stumped. Any advice welcome. Next, I'll try to copy all my code into a new Project (maybe it's VS problem?) ... if that doesn't sort it, I'll try moving to VS 2017.

    Thanks in advance.

    Saturday, February 23, 2019 12:14 PM


  • Eventually resolved by updating/reinstalling system files - ran a major Windows update.

    FWIW, repairing Office, reinstalling Office, and running all the Visual C++ / .NET updates didn't resolve the problem.

    • Marked as answer by Denton Thomas Sunday, March 10, 2019 1:27 AM
    Sunday, March 10, 2019 1:27 AM