AnsweredAssumed Answered

Any suggestions on how to accomplish this in a userform

Question asked by Harold Black on Jan 23, 2020
Latest reply on Jan 24, 2020 by Harold Black

I have a userform with some text boxes that I would like to try and mimic the functionality shown in the attached screen recording. I want to be able to click on any text box, make a selection in SolidWorks, and remain in the same text box until I click into another text box. I've gotten code to stay in a text box but that involves calling textbox1_Enter after a selection has been made. After a while I get an error "Out of stack space." I need some way to exit the current text box Enter event when a different text box is clicked, otherwise I will get loop stacking up. The problem I'm having is that I can't figure out a way to exit the previous Enter event if I'm automatically taken to the next text boxes Enter event sub procedure upon clicking. What would be the best approach to achieving this?


Private Sub textbox1_Enter()

   Do While swSelmgr.GetSelectedObjectCount < 2


      Set vSel = swSelmgr.GetSelectedObject6(1,-1)


      display selections name in textbox1

      Exit Do if selection



End Sub


I would have the same basic structure for my other text box(es), it would vary in the code to get information section.