הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Wednesday, June 13, 2012 4:04 PM
Hi,
how can I hide the combobox arrow?
Currently I cover the dropdown arrow with an image. But if I click on the image, the bacground of the arrow appears (the arrow itself no). How can I get rid of the arrow button?
All replies (5)
Thursday, June 14, 2012 12:11 AM ✅Answered
Hi DerStauner,
I think this is what you are looking for: Just start new project and add one combobox and try this code it will hide the arrow for you:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.DropDownStyle = ComboBoxStyle.Simple ComboBox1.Items.Add("Steve") ComboBox1.Items.Add("John") ComboBox1.Items.Add("Edward") ComboBox1.Items.Add("Stanley") ComboBox1.Items.Add("Murray") ComboBox1.Items.Add("Basil") End Sub Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp ComboBox1.DropDownStyle = ComboBoxStyle.Simple End Sub Private Sub ComboBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ComboBox1.MouseDown ComboBox1.DropDownStyle = ComboBoxStyle.DropDown ComboBox1.DroppedDown = True End SubEnd Class
Regards
Wednesday, June 13, 2012 4:49 PM
Why do you want a drop down box if you don't want the arrow? If you want the user to see the contents but not be able to change it, the simplest thing might be to make a text box the same size and put it in the same spot on the form (in the form.load event for example). Then just cycle the .visible property for the two controls depending upon which one you want the user to see.
Brian
Wednesday, June 13, 2012 6:25 PM
I want a drop down box, but not with the arrow, but with the image. And if I click on the image, the drop down list appears.
Wednesday, June 13, 2012 9:23 PM
I reread the question and you are trying to hide the drop down arrow behind an image and keep it hidden regardless. I can not recreate that problem - the arrow stays hidden - but I do get another problem you won't like. I end up with this:
I think as long as the combobox has the focus you are going to have that.
There is a way to resize the dop down list in VB6 but I'm too new at .Net stuff to know if it would work and I don't think it would be trivial.
I still think the easy way would be to define a textbox and (after rereading the question) a listbox. Put them in the same location and only have one be visible.
Brian
Thursday, June 14, 2012 4:33 PM
greath, thanks.