Combo Box coding on visual Basic.NET

  • Thread starter Thread starter Robert Repsher via .NET 247
  • Start date Start date
R

Robert Repsher via .NET 247

(Type your message here)
My professor left the class to learn Combo Box on our own.Building it was not a problem. But what event am I supposed toassociate with this object? How do I code so that when the userpicks from the list his/her choice is recognized as a string?The procedure-level variables in the program vary with each namein the list, so right now I have an interface that "has nobrains."
 
I dont quite understand what you're looking for.

Do you want to know what the text of the selected item in the list is?
In that case you can check out the SelectedText, SelectedItem and
SelectedIndex properties.

Are you looking to find a given string you have from the list of items in
the combobox list?
In that case you can check out the FindString and FindStringExact methods.

hope that helps..
Imran.

(Type your message here)
My professor left the class to learn Combo Box on our own. Building it was
not a problem. But what event am I supposed to associate with this object?
How do I code so that when the user picks from the list his/her choice is
recognized as a string? The procedure-level variables in the program vary
with each name in the list, so right now I have an interface that "has no
brains."
 
My professor left the class to learn Combo Box on our own. Building it was not a problem. But what event am I supposed to
associate with this object?

That is rather vauge. The Combobox is available from the toolbox, what
exactly did you build?

LFS
 
I think I now what your asking.

Add the combox to a form. Populate the "box" via the items property...click
on collection to the right, then click on the "..." and generate your list.

To extract the users choice from the combobox, the "event" is up to you.

Assume there is a command button on the form that is to extract the user's
choice upon being clicked. In the command1_click event, the combobox then
behaves like a text box....

i.e.

variablename=combobox1.text

for example.

the default event (the one that pops up when you dbl-click this control in
design view) for a combobox is the
Sub ComboBox1_SelectedIndexChanged(...)

event, which means that when a selection is made, or changed, this
subroutine runs. Within THAT sub you could also do the proverbial

variablename=combobox1.text

to capture the chosen combo boxvalue to do whatever you need to with
it......



Hope this helps....


Frank Bachman
(Grumpy Aero Guy)


(Type your message here)
My professor left the class to learn Combo Box on our own. Building it was
not a problem. But what event am I supposed to associate with this object?
How do I code so that when the user picks from the list his/her choice is
recognized as a string? The procedure-level variables in the program vary
with each name in the list, so right now I have an interface that "has no
brains."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top