PC Review


Reply
Thread Tools Rate Thread

Disable the search feature of a ComboBox

 
 
sid
Guest
Posts: n/a
 
      15th Jun 2010
Using the following code snip in VB.net, When I start the app and
pulldown the list from the combox box it tries to make a selection.
But I don't want this feature. How do I prevent it.
Why is the first item of the list selected as soon as the pulldown
drops ?


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim i As Integer

For i = 0 To 5
Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
"00"))
Next
Me.ComboBox1.Text = "A"

End Sub
 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      15th Jun 2010
sid wrote:
> Using the following code snip in VB.net, When I start the app and
> pulldown the list from the combox box it tries to make a selection.
> But I don't want this feature. How do I prevent it.
> Why is the first item of the list selected as soon as the pulldown
> drops ?
>
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Dim i As Integer
>
> For i = 0 To 5
> Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> "00"))
> Next
> Me.ComboBox1.Text = "A"


Me.ComboBox1.SelectedIndex = -1 -- to deselect combobox you
may have to execute the deselect statement twice.
>
> End Sub

 
Reply With Quote
 
sid
Guest
Posts: n/a
 
      16th Jun 2010
On Jun 15, 4:37*pm, "Mr. Arnold" <Arn...@Arnold.com> wrote:
> sid wrote:
> > Using the following code snip in VB.net, When I start the app and
> > pulldown the list from the combox box it tries to make a selection.
> > But I don't want this feature. How do I prevent it.
> > Why is the first item of the list selected as soon as the pulldown
> > drops ?

>
> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load

>
> > * * * * Dim i As Integer

>
> > * * * * For i = 0 To 5
> > * * * * * * Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> > "00"))
> > * * * * Next
> > * * * * Me.ComboBox1.Text = "A"

>
> * * * * * *Me.ComboBox1.SelectedIndex = -1 * -- to deselect combobox you
> may have to execute the deselect statement twice.
>
>
>
>
>
> > End Sub- Hide quoted text -

>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


I have already tried this without any success.
The autoselection is made when the list is opened, then the text field
is populated with whatever selection is the closest match.

I want to give the user the option to browse the selections with out
actually choosing one, and then they can choose or manually type an
entry in the text field.

 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      16th Jun 2010
It seems that you have set at design time the autocomplete property.


"sid" <(E-Mail Removed)> wrote in message
news:0c2d4abf-5f2c-4bc9-ab84-(E-Mail Removed)...
> Using the following code snip in VB.net, When I start the app and
> pulldown the list from the combox box it tries to make a selection.
> But I don't want this feature. How do I prevent it.
> Why is the first item of the list selected as soon as the pulldown
> drops ?
>
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Dim i As Integer
>
> For i = 0 To 5
> Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> "00"))
> Next
> Me.ComboBox1.Text = "A"
>
> End Sub


 
Reply With Quote
 
sid
Guest
Posts: n/a
 
      16th Jun 2010
On Jun 16, 1:52*am, "Cor Ligthert[MVP]" <Notmyfirstn...@planet.nl>
wrote:
> It seems that you have set at design time the autocomplete property.
>
> "sid" <sidwe...@alexian.net> wrote in message
>
> news:0c2d4abf-5f2c-4bc9-ab84-(E-Mail Removed)...
>
>
>
> > Using the following code snip in VB.net, When I start the app and
> > pulldown the list from the combox box it tries to make a selection.
> > But I don't want this feature. How do I prevent it.
> > Why is the first item of the list selected as soon as the pulldown
> > drops ?

>
> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load

>
> > * * * *Dim i As Integer

>
> > * * * *For i = 0 To 5
> > * * * * * *Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> > "00"))
> > * * * *Next
> > * * * *Me.ComboBox1.Text = "A"

>
> > End Sub- Hide quoted text -

>
> - Show quoted text -


No, I set this property to none at desing time and in the code after
the app started.

Private Sub form1_Load(ByVal sender ...
combobox1.AutocompleteMode = AutoCompleteMode.None
 
Reply With Quote
 
Onur Güzel
Guest
Posts: n/a
 
      16th Jun 2010
On Jun 15, 9:52*pm, sid <sidwe...@alexian.net> wrote:
> Using the following code snip in VB.net, When I start the app and
> pulldown the list from the combox box it tries to make a selection.
> But I don't want this feature. How do I prevent it.
> Why is the first item of the list selected as soon as the pulldown
> drops ?
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> * * * * Dim i As Integer
>
> * * * * For i = 0 To 5
> * * * * * * Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> "00"))
> * * * * Next
> * * * * Me.ComboBox1.Text = "A"
>
> End Sub


Probably your combobox's "DropDownStyle" property was NOT set to
"DropDownList" (Maybe it's "DropDown"). Based on my experiment, the
behaviour doesn't occur if it is a "DropDownList" combobox (No item
gets selected automatically when user clicks on Combobox).

HTH,

Onur Güzel
 
Reply With Quote
 
sid
Guest
Posts: n/a
 
      16th Jun 2010
On Jun 16, 1:17*pm, Onur Güzel <kimiraikkone...@gmail.com> wrote:
> On Jun 15, 9:52*pm, sid <sidwe...@alexian.net> wrote:
>
>
>
>
>
> > Using the following code snip in VB.net, When I start the app and
> > pulldown the list from the combox box it tries to make a selection.
> > But I don't want this feature. How do I prevent it.
> > Why is the first item of the list selected as soon as the pulldown
> > drops ?

>
> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load

>
> > * * * * Dim i As Integer

>
> > * * * * For i = 0 To 5
> > * * * * * * Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> > "00"))
> > * * * * Next
> > * * * * Me.ComboBox1.Text = "A"

>
> > End Sub

>
> Probably your combobox's "DropDownStyle" property was NOT set to
> "DropDownList" (Maybe it's "DropDown"). Based on my experiment, the
> behaviour doesn't occur if it is a "DropDownList" combobox (No item
> gets selected automatically when user clicks on Combobox).
>
> HTH,
>
> Onur Güzel- Hide quoted text -
>
> - Show quoted text -


Yes, but then you don't get a textbox to type in if you want to make
an entry that is not in the list.
 
Reply With Quote
 
Onur Güzel
Guest
Posts: n/a
 
      17th Jun 2010
On Jun 16, 11:15*pm, sid <sidwe...@alexian.net> wrote:
> On Jun 16, 1:17*pm, Onur Güzel <kimiraikkone...@gmail.com> wrote:
>
>
>
> > On Jun 15, 9:52*pm, sid <sidwe...@alexian.net> wrote:

>
> > > Using the following code snip in VB.net, When I start the app and
> > > pulldown the list from the combox box it tries to make a selection.
> > > But I don't want this feature. How do I prevent it.
> > > Why is the first item of the list selected as soon as the pulldown
> > > drops ?

>
> > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles MyBase.Load

>
> > > * * * * Dim i As Integer

>
> > > * * * * For i = 0 To 5
> > > * * * * * * Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> > > "00"))
> > > * * * * Next
> > > * * * * Me.ComboBox1.Text = "A"

>
> > > End Sub

>
> > Probably your combobox's "DropDownStyle" property was NOT set to
> > "DropDownList" (Maybe it's "DropDown"). Based on my experiment, the
> > behaviour doesn't occur if it is a "DropDownList" combobox (No item
> > gets selected automatically when user clicks on Combobox).

>
> > HTH,

>
> > Onur Güzel- Hide quoted text -

>
> > - Show quoted text -

>
> Yes, but then you don't get a textbox to type in if you want to make
> an entry that is not in the list.


Yes, i have tought that but there's no such event that's fired after
dropdown portion is displayed then we would have chance to change
selectedindex. However, in the code of comobox item population which
you posted , "A-00" gets selected automatically because you're setting
text "A" to combobox. As you want leave DropDownStyle property as
"DropDown", which allows you to edit combox text area with keyboard,
you can overcome this behaviour by adding a textbox above the
combobox, whose height will be same as combobox and width will be less
as much as combobox's drop-down arrow, then you send back the
combobox, in your form_load set text to textbox, rather than combobox:

Like:

Dim i As Integer
For i = 0 To 5
Me.ComboBox1.Items.Add _
(Chr(65 + i) & "- " & Format(i, "00"))
Next
Me.TextBox1.Text = "A"

Finally, of course you must equalise combobox selection with textbox,
if user selects any item in combobox.

Private Sub ComboBox1_SelectedIndexChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.SelectedItem
End Sub

At this time you will be able to use drop-down portion of combobox but
nobody will see any selection as textbox is in the front. To describe
what i mean, look at the screenshoot which will clarify the trick:

http://img541.imageshack.us/img541/8721/resimnew.jpg

HTH,

Onur Güzel

 
Reply With Quote
 
sid
Guest
Posts: n/a
 
      17th Jun 2010
On Jun 17, 1:25*am, Onur Güzel <kimiraikkone...@gmail.com> wrote:
> On Jun 16, 11:15*pm, sid <sidwe...@alexian.net> wrote:
>
>
>
>
>
> > On Jun 16, 1:17*pm, Onur Güzel <kimiraikkone...@gmail.com> wrote:

>
> > > On Jun 15, 9:52*pm, sid <sidwe...@alexian.net> wrote:

>
> > > > Using the following code snip in VB.net, When I start the app and
> > > > pulldown the list from the combox box it tries to make a selection.
> > > > But I don't want this feature. How do I prevent it.
> > > > Why is the first item of the list selected as soon as the pulldown
> > > > drops ?

>
> > > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load

>
> > > > * * * * Dim i As Integer

>
> > > > * * * * For i = 0 To 5
> > > > * * * * * * Me.ComboBox1.Items.Add(Chr(65 + i) & "- " &Format(i,
> > > > "00"))
> > > > * * * * Next
> > > > * * * * Me.ComboBox1.Text = "A"

>
> > > > End Sub

>
> > > Probably your combobox's "DropDownStyle" property was NOT set to
> > > "DropDownList" (Maybe it's "DropDown"). Based on my experiment, the
> > > behaviour doesn't occur if it is a "DropDownList" combobox (No item
> > > gets selected automatically when user clicks on Combobox).

>
> > > HTH,

>
> > > Onur Güzel- Hide quoted text -

>
> > > - Show quoted text -

>
> > Yes, but then you don't get a textbox to type in if you want to make
> > an entry that is not in the list.

>
> Yes, i have tought that but there's no such event that's fired after
> dropdown portion is displayed then we would have chance to change
> selectedindex. However, in the code of comobox item population which
> you posted , "A-00" gets selected automatically because you're setting
> text "A" to combobox. As you want leave DropDownStyle property as
> "DropDown", which allows you to edit combox text area with keyboard,
> you can overcome this behaviour by adding a textbox above the
> combobox, whose height will be same as combobox and width will be less
> as much as combobox's drop-down arrow, then you send back the
> combobox, in your form_load set text to textbox, rather than combobox:
>
> Like:
>
> Dim i As Integer
> For i = 0 To 5
> Me.ComboBox1.Items.Add _
> (Chr(65 + i) & "- " & Format(i, "00"))
> Next
> Me.TextBox1.Text = "A"
>
> Finally, of course you must equalise combobox selection with textbox,
> if user selects any item in combobox.
>
> Private Sub ComboBox1_SelectedIndexChanged _
> (ByVal sender As System.Object, _
> ByVal e As System.EventArgs) _
> Handles ComboBox1.SelectedIndexChanged
> TextBox1.Text = ComboBox1.SelectedItem
> End Sub
>
> At this time you will be able to use drop-down portion of combobox but
> nobody will see any selection as textbox is in the front. To describe
> what i mean, look at the screenshoot which will clarify the trick:
>
> http://img541.imageshack.us/img541/8721/resimnew.jpg
>
> HTH,
>
> Onur Güzel- Hide quoted text -
>
> - Show quoted text -


This was a good solution. I was about to start to create my own
control.
Another programmer had the idea of adding a space to the text on
'DropDown', this fools the Autocomplete by not finding a match, but
this solution was not consistent. Timing issues ...

The floating textbox worked perfectly.

Thanks



 
Reply With Quote
 
Onur Güzel
Guest
Posts: n/a
 
      19th Jun 2010
On Jun 17, 11:27 pm, sid <sidwe...@alexian.net> wrote:
> On Jun 17, 1:25 am, Onur Güzel <kimiraikkone...@gmail.com> wrote:
>
>
>
> > On Jun 16, 11:15 pm, sid <sidwe...@alexian.net> wrote:

>
> > > On Jun 16, 1:17 pm, Onur Güzel <kimiraikkone...@gmail.com> wrote:

>
> > > > On Jun 15, 9:52 pm, sid <sidwe...@alexian.net> wrote:

>
> > > > > Using the following code snip in VB.net, When I start the app and
> > > > > pulldown the list from the combox box it tries to make a selection.
> > > > > But I don't want this feature. How do I prevent it.
> > > > > Why is the first item of the list selected as soon as the pulldown
> > > > > drops ?

>
> > > > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> > > > > System.EventArgs) Handles MyBase.Load

>
> > > > > Dim i As Integer

>
> > > > > For i = 0 To 5
> > > > > Me.ComboBox1.Items.Add(Chr(65 + i) & "- " & Format(i,
> > > > > "00"))
> > > > > Next
> > > > > Me.ComboBox1.Text = "A"

>
> > > > > End Sub

>
> > > > Probably your combobox's "DropDownStyle" property was NOT set to
> > > > "DropDownList" (Maybe it's "DropDown"). Based on my experiment, the
> > > > behaviour doesn't occur if it is a "DropDownList" combobox (No item
> > > > gets selected automatically when user clicks on Combobox).

>
> > > > HTH,

>
> > > > Onur Güzel- Hide quoted text -

>
> > > > - Show quoted text -

>
> > > Yes, but then you don't get a textbox to type in if you want to make
> > > an entry that is not in the list.

>
> > Yes, i have tought that but there's no such event that's fired after
> > dropdown portion is displayed then we would have chance to change
> > selectedindex. However, in the code of comobox item population which
> > you posted , "A-00" gets selected automatically because you're setting
> > text "A" to combobox. As you want leave DropDownStyle property as
> > "DropDown", which allows you to edit combox text area with keyboard,
> > you can overcome this behaviour by adding a textbox above the
> > combobox, whose height will be same as combobox and width will be less
> > as much as combobox's drop-down arrow, then you send back the
> > combobox, in your form_load set text to textbox, rather than combobox:

>
> > Like:

>
> > Dim i As Integer
> > For i = 0 To 5
> > Me.ComboBox1.Items.Add _
> > (Chr(65 + i) & "- " & Format(i, "00"))
> > Next
> > Me.TextBox1.Text = "A"

>
> > Finally, of course you must equalise combobox selection with textbox,
> > if user selects any item in combobox.

>
> > Private Sub ComboBox1_SelectedIndexChanged _
> > (ByVal sender As System.Object, _
> > ByVal e As System.EventArgs) _
> > Handles ComboBox1.SelectedIndexChanged
> > TextBox1.Text = ComboBox1.SelectedItem
> > End Sub

>
> > At this time you will be able to use drop-down portion of combobox but
> > nobody will see any selection as textbox is in the front. To describe
> > what i mean, look at the screenshoot which will clarify the trick:

>
> >http://img541.imageshack.us/img541/8721/resimnew.jpg

>
> > HTH,

>
> > Onur Güzel- Hide quoted text -

>
> > - Show quoted text -

>
> This was a good solution. I was about to start to create my own
> control.
> Another programmer had the idea of adding a space to the text on
> 'DropDown', this fools the Autocomplete by not finding a match, but
> this solution was not consistent. Timing issues ...
>
> The floating textbox worked perfectly.
>
> Thanks


Glad it worked,

cheers,

Onur
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Completely delete/disable Search Folders feature OLK2K3 Canjura Microsoft Outlook Discussion 1 31st Jul 2009 03:23 PM
ComboBox and Not on list feature =?Utf-8?B?Qm9iYnllIFI=?= Microsoft Access Form Coding 0 30th Jul 2007 03:50 AM
How to disable the "ESC feature" of a ComboBox? Stefan Mueller Microsoft Excel Programming 1 24th Jul 2007 12:58 AM
Disable search feature in merged document - Word 2002 =?Utf-8?B?RG9ubmE=?= Microsoft Word Document Management 3 17th Nov 2006 10:47 PM
How to disable search i ListBox/ComboBox BVM Microsoft Dot NET Framework Forms 1 9th May 2006 03:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:17 PM.