[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

missing dropbox.selekteditem.value  in vb2008

Posted on 2014-01-12
3
Medium Priority
?
254 Views
Last Modified: 2014-01-13
entityview from dropboxi can't get the dropbox.value
0
Comment
Question by:ebertsys
[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
3 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39776029
ComboBoxes don't have a SelectedItem.Value. The availible properties are; SelectedItem, SelectedValue and SelectedIndex.

I know it can be confusing with all the properties a combobox has to access the selected item in the control.

I highly recommend that you read this blog entry on this topic.

I will copy it here in case the link changes or gets removed.
ComboBox SelectedItem, SelectedValue, SelectedWhat???

ComboBox has a lot of helpful properties that allow you to get access to items selected by the Control.  The problem is knowing which one is best in which scenario.  The documentation is not 100% clear on what the values will be in various situations.  The most important factor to know is whether or not you are DataBinding in the ComboBox.

DataBinding Case

In this case the properties will have the following values

    SelectedItem - For gets this will return the actual object in the DataSource that is being displayed in the ComboBox.  For sets if the value exists in the DataSource, it will be selected, otherwise the operation will complete without an exception but won't actually do anything.
    SelectedValue - This property depends on the value of ValueMember.

    If the property ValueMember is not Nothing the ComboBox will look for a member on SelectedItem with the name specified in ValueMember and return that.  This is also the value displayed in the ComboBox.

    If the property ValueMember is Nothing, then the SelectedValue will return .ToString() on the SelectedItem
    SelectedIndex - Index of SelectedItem in the DataSource

Non-DataBinding Case

    SelectedItem - Gets and Sets both go to the currently selected object from the Items collection
    SelectedValue - Will be Nothing/null
    SelectedIndex - Index in the Items collection of the SelectedItem
0
 

Author Comment

by:ebertsys
ID: 39776362
Sorry for low details.
I want to have the id and the Text.
What i found in www is...bind the combox to a list.
So i put my sqlreader into a list and set the list as datasource
and set .valuemember=id
and set .textmember = text

and i want ..after.selctedindexchange the id of the selecte text.
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 39776387
That's what SelectedIndex is for.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 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