PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET ComboBox DroppedDown questions

Reply

ComboBox DroppedDown questions

 
Thread Tools Rate Thread
Old 16-04-2007, 04:50 AM   #1
Paul
Guest
 
Posts: n/a
Default ComboBox DroppedDown questions


VB.NET 2003. I am loading a dialog box form with a ComboBox. I'm
using a DropDownStyle of "DropDown" rather than "DropDownList". I
want them to be able to type in it fill in as they type. The ComboBox
contains a list of cities. The form will receive a parameter of one
alpha-numeric character.

I want to do two things (that I don't know how to do):

1. The parameter received to be moved to the ComboBox and the cursor
to be positioned
at the end of the character. So they can continue to type and
have the city filled in.
I can get the ComboBox.Text to be the value of the parameter.
But the field is selected.
I cannot get it unselected. So they have the type the character
a second time.

2. The list box part of the ComboBox dropped down. I can get it to
drop down. But the
list box part then goes back up. I'm guessing it is because the
form is loading. I've tried
putting the code in the Form Activated event, but that didn't
help.

Any suggestions?

  Reply With Quote
Old 16-04-2007, 08:43 AM   #2
ClayB
Guest
 
Posts: n/a
Default Re: ComboBox DroppedDown questions

Try this code.

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.ComboBox1.DroppedDown = True
Me.ComboBox1.Text = ""
Me.ComboBox1.Focus()
SendKeys.Send("S") 'set an S into the combobox
End Sub

=================
Clay Burch
Syncfusion, Inc.

  Reply With Quote
Old 17-04-2007, 02:08 AM   #3
Paul
Guest
 
Posts: n/a
Default Re: ComboBox DroppedDown questions

Thanks Clay. I had thought of that too, but wanted to avoid it. I
don't like using the SendKeys command. You can never really know how
the keys are going to be sent. But it did work and I'm going with it
for now.

  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off