I am fairly new to arrays, and try to avoid them because I always get stuck in positions like this.
I have and array of 8 textboxes and by double clicking on any of the textboxes a list box will appear. Well my problem is how do I put the listbox selection into the textbox it was called from, and how do I set focus back to the textbox?
Thank youCode:Private Sub lstCode_DblClick() For i = 0 To lstCode.ListCount - 1 'Loop to find selection If lstCode.Selected(i) = True Then 'If selected For j = 0 To txtCode.Count - 1 '****************************************** 'NEED TO DETERMINE HOW TO PLACE SELECTED VALUE IN 'ORIGINAL TEXT BOX '****************************************** If txtCode(j). Then txtCode(j).Text = lstCode.Text 'Display selection End If Next j End If Next i lstCode.Visible = False 'Hide lstbox '*************************************** 'NEED TO SET FOCUS BACK TO ORIGINAL TEXT BOX '****************************************** For j = 0 To txtTestCode.Count - 1 txtTestCode(j).SetFocus Next j End Sub





Reply With Quote