473,403 Members | 2,222 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,403 software developers and data experts.

Problem with Combobox in VB

123 100+
I have added combobox on my form. How to check at runtime that whether user has selected an item from the combobox or not? Please tell me code for that.

I.e. I have added 3 items to combobox on form load event. When i click on Save button i want to check whether user has made selection from combobox or not. What property do i need to write for that?
Feb 24 '07 #1
3 1515
hariharanmca
1,977 1GB
I have added combobox on my form. How to check at runtime that whether user has selected an item from the combobox or not? Please tell me code for that.

I.e. I have added 3 items to combobox on form load event. When i click on Save button i want to check whether user has made selection from combobox or not. What property do i need to write for that?

Expand|Select|Wrap|Line Numbers
  1. if cmbName.Listindex < 0 then
  2.          ' Not Selected Code
  3. else
  4.           'Selected Code
  5. endif
This will solve you
Feb 24 '07 #2
Esmael
58
Hi...

And pls add that code to the combobox click event
Heres the complete snippets code:

Private Sub Combo1_Click()
if cmbName.Listindex < 0 then
' Not Selected Code
else
'Selected Code
endif
end sub


GOodLuck...
Feb 26 '07 #3
balid
18
I have added combobox on my form. How to check at runtime that whether user has selected an item from the combobox or not? Please tell me code for that.

I.e. I have added 3 items to combobox on form load event. When i click on Save button i want to check whether user has made selection from combobox or not. What property do i need to write for that?
Since you want the check to occur when the user has clicked on the Save button put the combobox selection check in the button click event.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub save_button_Click()
  3.    if combobox1.Listindex < 0 then
  4.       ' Not Selected Code
  5.    else
  6.       'Selected Code
  7.    endif
  8. end sub
  9.  
Feb 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the...
0
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the...
6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
0
by: Jax | last post by:
I am using a class that inherits from the DataGridTextBoxColumn. It adds a combo box into the column where it displays a selection of choices. The problem I have is that when this comboBox loses...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
0
by: tupolev | last post by:
Hi, I already post this item but now I know whats wrong: I want to allow the user to edit the items in a combobox. The problem is that the textchange event works just one time (for the first...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
1
by: amber | last post by:
I'm having an issue with a combobox that is making no sense to me at all. I have a form with several comboboxes/textboxes. The values in these boxes are based on a datarowview, which is based on...
1
by: Aleksey Timonin | last post by:
Hi guys, I have a comboBox binded to DataTable: comboBox.DataSource = MyDataTable; comboBox.ValueMember = "id"; comboBox.DisplayMember = "id";
6
by: RamonPV | last post by:
Hello: I am having a problem with to linked comboxes in IE7. Here is my problem that is ONLY ocurring in IE7: I have javascripts functions to populate the second of 2 comboxes given the selected...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.