By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,577 Members | 1,899 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,577 IT Pros & Developers. It's quick & easy.

ComboBox question

P: n/a
I have a combo box with items as:

1 - can be selected
2 - currently selected
3 - can NOT be selected
4 - can NOT be selected
5 - can NOT be selected

my currently selected item is 2. I want to allow user to select any
item thant is <= current item (1, or 2), but not any of items > 2
(3, 4, 5).

If user select any of items 3, 4, or 5, he should be notified that
that is invalid selecting and combo box should reset itself to the
current item (item 2)

How can I do that?

Thanks
Dino
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

I do not know of any way to disable an item in a combobox. You
would have to filter the items in the combobox so only the valid items are
available to select.

Ken
---------------
"Dino Buljubasic" <di**@noplacelikehome.com> wrote in message
news:uu********************************@4ax.com...
I have a combo box with items as:

1 - can be selected
2 - currently selected
3 - can NOT be selected
4 - can NOT be selected
5 - can NOT be selected

my currently selected item is 2. I want to allow user to select any
item thant is <= current item (1, or 2), but not any of items > 2
(3, 4, 5).

If user select any of items 3, 4, or 5, he should be notified that
that is invalid selecting and combo box should reset itself to the
current item (item 2)

How can I do that?

Thanks
Dino
Nov 21 '05 #2

P: n/a
DSJ
This should do it:

Code:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

If ComboBox1.SelectedIndex > 1 Then

MessageBox.Show("Unauthorised selection")

ComboBox1.SelectedIndex = 1

End If

End Sub

HTH

Ged

"Dino Buljubasic" <di**@noplacelikehome.com> wrote in message
news:uu********************************@4ax.com...
I have a combo box with items as:

1 - can be selected
2 - currently selected
3 - can NOT be selected
4 - can NOT be selected
5 - can NOT be selected

my currently selected item is 2. I want to allow user to select any
item thant is <= current item (1, or 2), but not any of items > 2
(3, 4, 5).

If user select any of items 3, 4, or 5, he should be notified that
that is invalid selecting and combo box should reset itself to the
current item (item 2)

How can I do that?

Thanks
Dino

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.