?
Solved

What is the best way to validate a selected value in a ComboBox?

Posted on 2013-12-04
2
Medium Priority
?
285 Views
Last Modified: 2013-12-05
What is the best or preferred method to validate a value selected from a ComboBox. What are the best Events to use?

Thanks!
0
Comment
Question by:BlakeMcKenna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 1400 total points
ID: 39697241
Depends on what you intend to validate and how. Otherwise, you would not have all the choices that are offered.

SelectedIndexChanged is very often the best choice because it is triggered for every change of selection.

SelectedValueChanged might be better in some circumstances, specially if you have many entries in the list that ends up returning the same value. In such a case, moving between 2 such entries would not trigger the event.

And although I find it more useful in other controls such as a TextBox, Validating could also be considered because its e.Cancel parameter makes it easy to keep the cursor in the ComboBox without triggering a few other events when the validation falls flat.
0
 

Author Comment

by:BlakeMcKenna
ID: 39698227
So whatever Event uses the e validating argument, setting "e.Cancel = True" will keep the cursor in that control? Don't know why I never bothered to look that one up!

Thanks James
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question