Link to home
Start Free TrialLog in
Avatar of RWayneH
RWayneHFlag for United States of America

asked on

Userform, ComboBox move TabIndex after list selection

If I have a userform that has a Listcombobox on it.  How do I (after a selection is complete on the combobox) automatically move it to the next TabIndex?  Also on the same topic of userforms.  I have a textbox that will get a large description in it.  I would like to have some text in it that says "Add defeat description here:" that hightlights, but when you type it overwrites that default text?  Then last, how do I wrap the text in the textbox?  It is a larger one, but when the input reaches the outer limit of the box, it scrolls right instead of wraps.  Wrap is set to True??   Looking for a little assistance with a userform.  Thanks.
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

When you say "Listcombobox" do you mean combobox, listbox, listview?

Can you attach your workbook?
SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RWayneH

ASKER

MulitiLn set to True worked!!  Thanks.  I believe it is a combobox.  I click the down arrow or start typing and it autofills. After the autofill I wanted it to move to the next textbox automatically instead of having to press the tab or click in the field.  Any ideas?
That's the Tab Order that you need to set. Just do as i suggested and use the UP and Down  arrows to select the order that you want the controls to move to when the Tab button is used

User generated image
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RWayneH

ASKER

Yup, that covers the default text in the TextBox..  Cool!!.  Going to remove the request to move the cursor after a selection... in more cases than not, we are just typing out the first few chars and pressing tab anyway.
Avatar of RWayneH

ASKER

Thanks for the help!!
It's much simpler to just use a Label with the TextBox, but this will highlight the Text in the TextBox when the user clicks into it and allow over writing of the test. Note the text is added in the initialize event

Option Explicit


Private Sub cmdEnter_Click()
    Unload Me
End Sub

Private Sub TextBox1_Enter()
    With Me.TextBox1
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
End Sub

Private Sub UserForm_Initialize()
    Me.TextBox1.Text = "Enter a description here"
End Sub

Open in new window

EE-sellength.xlsm
Bit quick deciding, but pleased to help
If you don't want to see the blinking cursor at all when the userform opens, then add a small second textbox and change the UserForm_Activate code to this.

Private Sub UserForm_Activate()

TextBox1.ForeColor = RGB(160, 160, 160)
TextBox1.Text = "Add defeat description here:"

TextBox2.SetFocus
TextBox2.Left = -2000

End Sub

Open in new window


In any case you're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015