• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 870
  • Last Modified:

comboboxes How to get the valuemember

I bound data to a combobox through the form provided.  Why can I not retrieve the valuemember as a value and not the name of the data field.  Maybe I am not understanding how the combobox works.  Any help is appreciated.  
0
monica73174
Asked:
monica73174
  • 9
  • 5
  • 3
  • +2
1 Solution
 
clarkscottCommented:
me.yourcombobox.text ??????
If you are using ADO data control, you can view the recordset value

adocontrol!comboboxfield

Scott C
0
 
davecorunCommented:
If you want to get the value out of the ComboBox, you need to look at the SelectedItem or SelectedIndex.  If I understand your question correctly.
0
 
Bob LearnedCommented:
Dim value As String = ComboBox1.SelectedValue

Bob
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
monica73174Author Commented:
I can grab me.yourcombobox.text but I also need the value that I gave it behind the sceenes.  

I out put the name of an advisor but behind the sceenes I have the id of the advisor which is the value I need to grab.  Wont SelectedIndex give me the index of the item in the combobox and not the value?  And I think SelectedItem gives me a blank value.  So is there something i am doing wrong with setting up the combobox?  

in the dialog box for setting up the combobox I have my data source as InstitutionsBindingSource, my display member is masterName and the Value Member is mgr_id, Im not sure what to do with the selected value box.  

So what do I use to grab the mgr_id value?  If this is unclear let me know and i will try to explain it a different way.
0
 
Bob LearnedCommented:
Can you show us how you are binding the ComboBox, and setting DisplayMember and ValueMember?

Bob
0
 
jpaulinoCommented:
0
 
monica73174Author Commented:
combobox.selectedValue comes up blank.
0
 
monica73174Author Commented:
i am using the dialog box in VS to bind the values.  
0
 
Bob LearnedCommented:
What is the DataSource set to?

Bob
0
 
monica73174Author Commented:
The datasource says InstitutionBindingSource,  I think I created this through the combobox dialog box as well.  
0
 
monica73174Author Commented:
Is it better to just manually bind the combo box?  
0
 
jpaulinoCommented:
When you bind it you can chose the DisplayMember (the field that will show) and the ValueMember (the ID). Is that selected ?
0
 
monica73174Author Commented:
Yes both of those are selected and populated.  
0
 
jpaulinoCommented:
And do you see the items on the combobox ?

Try to change the fields DisplayMember and ValueMember and check it.
0
 
monica73174Author Commented:
I switched the fields around and the value member is populating.
0
 
monica73174Author Commented:
I mean the ID field is now in the display member and I can see them.
0
 
jpaulinoCommented:
So right now if you select any Id from the combobox and try Combobox.SelectedValue what do you get ?
0
 
monica73174Author Commented:
Actually after I switched the fields and then swtiched them back its working.  This is just strange.  
0
 
jpaulinoCommented:
Maybe your selection wasn't correct or missing something.

Sometimes it happens!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 5
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now