Solved

check if combo box has selection vb.net

Posted on 2016-08-01
5
135 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DataGridView Events ? 3 45
Vb.net dynamic formulas in runtime 11 74
Disable extension 8 37
Store results in vb.net 3 20
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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