Solved

check if combo box has selection vb.net

Posted on 2016-08-01
5
103 Views
Last Modified: 2016-08-01
i have 3 combo boxes on a form  in vb.net. the 3rd combo needs the selection from both of the previous. How do i check that both cb1 and 2 have items selected?
there is no order of selection the user can change 1 or 2 in either order as long as i can make cb3 respond
0
Comment
Question by:PeterBaileyUk
  • 3
  • 2
5 Comments
 

Author Comment

by:PeterBaileyUk
ID: 41737456
I just wrote this
  If (String.IsNullOrEmpty(CBNote.SelectedItem)) And (String.IsNullOrEmpty(CBScaleType.SelectedItem)) Then
            Call GetCBData("usp_GetChords")
        End If

not sure if its correct way
0
 

Author Comment

by:PeterBaileyUk
ID: 41737457
apart from the blinding obvious that i need an else and need to move the call to the correct part
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 41737468
You can use the ComboBox.SelectedIndex property to know if a item has been selected in the ComboBox. It returns the zero base index of the selected item or if no item has been selected -1.
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 41737472
I did try and ceremoniously failed. thx again
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 41737474
Did you get it working?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net - For Loop Error 5 37
SQL syntax in VB.net 5 30
Pagebreak issue while printing the aspx page 3 15
Get the selected ValueMember of Combobox 5 21
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now