PDA

View Full Version : Block User From Editing The Combo Box Text Value



PcMax
08-17-2013, 03:07 AM
Hi

I have a Userform to insert a Combobox.
To avoid that you could change the text of the ComboBox I added:


Private Sub ComboBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
KeyAscii = 0
End Sub
Wonder if you can disable the ability for scrolling through all the items to activate a button outside the ComboBox.

any idea on how to solve this issue?

thanks in advance

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://eileenslounge.com/viewtopic.php?p=317218#p317218 (https://eileenslounge.com/viewtopic.php?p=317218#p317218)
https://eileenslounge.com/viewtopic.php?p=316955#p316955 (https://eileenslounge.com/viewtopic.php?p=316955#p316955)
https://eileenslounge.com/viewtopic.php?p=316955#p316955 (https://eileenslounge.com/viewtopic.php?p=316955#p316955)
https://eileenslounge.com/viewtopic.php?p=316940#p316940 (https://eileenslounge.com/viewtopic.php?p=316940#p316940)
https://eileenslounge.com/viewtopic.php?p=316927#p316927 (https://eileenslounge.com/viewtopic.php?p=316927#p316927)
https://eileenslounge.com/viewtopic.php?p=317014#p317014 (https://eileenslounge.com/viewtopic.php?p=317014#p317014)
https://eileenslounge.com/viewtopic.php?p=317006#p317006 (https://eileenslounge.com/viewtopic.php?p=317006#p317006)
https://eileenslounge.com/viewtopic.php?p=316935#p316935 (https://eileenslounge.com/viewtopic.php?p=316935#p316935)
https://eileenslounge.com/viewtopic.php?p=316875#p316875 (https://eileenslounge.com/viewtopic.php?p=316875#p316875)
https://eileenslounge.com/viewtopic.php?p=316254#p316254 (https://eileenslounge.com/viewtopic.php?p=316254#p316254)
https://eileenslounge.com/viewtopic.php?p=316280#p316280 (https://eileenslounge.com/viewtopic.php?p=316280#p316280)
https://eileenslounge.com/viewtopic.php?p=315915#p315915 (https://eileenslounge.com/viewtopic.php?p=315915#p315915)
https://eileenslounge.com/viewtopic.php?p=315512#p315512 (https://eileenslounge.com/viewtopic.php?p=315512#p315512)
https://eileenslounge.com/viewtopic.php?p=315744#p315744 (https://eileenslounge.com/viewtopic.php?p=315744#p315744)
https://www.eileenslounge.com/viewtopic.php?p=315512#p315512 (https://www.eileenslounge.com/viewtopic.php?p=315512#p315512)
https://eileenslounge.com/viewtopic.php?p=315680#p315680 (https://eileenslounge.com/viewtopic.php?p=315680#p315680)
https://eileenslounge.com/viewtopic.php?p=315743#p315743 (https://eileenslounge.com/viewtopic.php?p=315743#p315743)
https://www.eileenslounge.com/viewtopic.php?p=315326#p315326 (https://www.eileenslounge.com/viewtopic.php?p=315326#p315326)
https://www.eileenslounge.com/viewtopic.php?f=30&t=40752 (https://www.eileenslounge.com/viewtopic.php?f=30&t=40752)
https://eileenslounge.com/viewtopic.php?p=314950#p314950 (https://eileenslounge.com/viewtopic.php?p=314950#p314950)
https://www.eileenslounge.com/viewtopic.php?p=314940#p314940 (https://www.eileenslounge.com/viewtopic.php?p=314940#p314940)
https://www.eileenslounge.com/viewtopic.php?p=314926#p314926 (https://www.eileenslounge.com/viewtopic.php?p=314926#p314926)
https://www.eileenslounge.com/viewtopic.php?p=314920#p314920 (https://www.eileenslounge.com/viewtopic.php?p=314920#p314920)
https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837 (https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

Excel Fox
08-17-2013, 03:29 AM
The way you've set up your combo box, you cannot make any change to the text. So what is your question?

Excel Fox
08-17-2013, 03:33 AM
If you don't want to use code, you could change the style of the combo box from 0 - fmStyleDropDownCombo to 2 - fmStyleDropDownList

PcMax
08-17-2013, 03:50 AM
Hi,

If I open the form, and I scroll items in the list with the Up Dn when I get to the last item selected from the combobox does not have to go out and pick me the next button.
A problem common to all the combobox I've tried.

Excel Fox
08-17-2013, 04:11 AM
does not have to go out and pick me the next buttonCannot understand this part!

PcMax
08-17-2013, 04:24 AM
Hi,

One step at a time.
I have attached some pictures to show the sequence that I note.

1) I open the Form
2) I flow with the keyboard entries
3) When the Combobox showed the last line is disabled by selecting the button below.

Wonder if you can get to the last line before exiting the ComboBox.

Excel Fox
08-17-2013, 08:01 AM
It took me 3 hours to understand this (I think I did). So what you're saying is that as you focus on the combo box and press the down arrow to scroll down the list of combo box items, after you reach the last entry (December in this case), and you press the down button again, the focus jumps to the next control in the tab index (the Conferma button in this case), correct?

I guess that's how all combo boxes work, and I do not understand what's the disadvantage in that. On the contrary, I find that as an advantage, instead of having to work on the tab button, or use the cursor.

PcMax
08-17-2013, 11:38 AM
Hi,


I guess that's how all combo boxes work, and I do not understand what's the disadvantage in that. On the contrary, I find that as an advantage, instead of having to work on the tab button, or use the cursor.

I absolutely have to avoid that one can select the following check.
Alternatively, if you do not find a solution I'll use a ListBox, this review is limited to swipe its entirety.

Imagine a form with multiple combobox selection problem which create

PcMax
08-17-2013, 02:42 PM
Hi,

I had tried unsuccessfully with other controls

To Restrict the selection in the combobox, I added the following code:


Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 40 Then
With Me.ComboBox1
If .ListIndex + 1 = .ListCount Then KeyCode = 0
End With
End If
End Sub

Here is the latest correct version