Groups | Blog | Home
all groups > vb.net controls > february 2004 >

vb.net controls : Newbie Combobox question



Ot
2/19/2004 8:44:26 AM
I think I want a combo box, but I am not really sure.

What I would like is this:

As I go through the lines of the database there is a piece of data that I
would like to get from the user. This is the Group to which the item
belongs.

I would like a control that has a list of choices for Group, sorted
alphabetically. The user can "open" the choices and choose one or locate
one by beginning to type alphabetically. If the user doesn't find one,
they can add one (hopefully in the same box). If the text the user has
typed doesn't exist when they click update it becomes a valid group. If
the user highlights a portion of the existing description and then hits
enter (the description is read-only) that selection is to be typed into the
group control (possibly overridden by user). If the user doubleclicks a
word in the description, the word highlighted is to be typed into the group
control.

I would also like to bring up a "probable" or "default" group. If the
description contains one of the existing group's text (disregarding case)I
would like to default to that one as the initial choice. There may be
group names that, in turn, contain in their text shorter group names. If
two group name's text is in the description, I'd like to default to the
longer text.

I am a newbie and have never used a combo box at all.

Is it possible to do the above?

Are there some examples similar to this that I can look at?

Regards,
Ot

Mark Martin
2/20/2004 1:28:40 PM
Hi

I believe that what you want a control to do describes a combo box pretty
accurately. Of course the extra functionality you want (double clicking a
word, add a valid group, probable/default group etc) require you to write
code in other control events to make them happen. A combo box allows you to
create and sort the list of items and select an existing item or type a new
item. Other than that you need to write code in the various controls events
to get your other functionality. I believe everything you want can be done
but I don't have any existing code to share with you. Much of the you will
have to write will need to be in the combo box click event and change event
and also in the description control click event.

The vb/vs help files can be a great help in explaining the control events
and in finding the functions, methods and properties you need and provide
some code snippets too.


Mark

[quoted text, click to view]

Ot
2/20/2004 7:08:58 PM

[quoted text, click to view]

Yes, I have been perusing the help files. Grrr.

I'll keep searching. Thanks Mark.

AddThis Social Bookmark Button