473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ComboBox question

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
2 856
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Mr. B | last post by:
I've been seeking the solution to this. But can't figure it out (sounds simple enough). When you Populat a ComboBox, you can select the initial displayed items on startup simply by setting the...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
10
by: Mr. B | last post by:
I've been seeking the solution to this. But can't figure it out (sounds simple enough). When you Populat a ComboBox, you can select the initial displayed items on startup simply by setting the...
6
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows...
10
by: Mr. B | last post by:
I've been seeking the solution to this. But can't figure it out (sounds simple enough). When you Populat a ComboBox, you can select the initial displayed items on startup simply by setting the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.