[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Getting the default value of a databound combobox

Posted on 2008-06-10
6
Medium Priority
?
236 Views
Last Modified: 2010-04-23
I have a combobox that is populated like this

                Me.cbReportParam.DisplayMember = "Name"
                Me.cbReportParam.ValueMember = "Name_ID"
                Me.cbReportParam.DataSource = ds.Tables("Names")

It populates correctly. So the first selection is "Adam". How do I get the name to my variable strName?
When I try strName = me.cbReportParam.SelectedItem it returns {System.Data.DataRowView}
I dont want to hardcode "Adam" because a name could be added before it later on.
0
Comment
Question by:bertino12
[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
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:Stephen Manderson
ID: 21751371
Hi there,

use the .SelectedText property for this

Regards
Steve
0
 

Author Comment

by:bertino12
ID: 21751391
It returns ""
0
 
LVL 19

Expert Comment

by:Stephen Manderson
ID: 21751438
Try

Me.StrName = Me.cbReportParam.SelectedItem.ToString

Regards
Steve
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Accepted Solution

by:
bertino12 earned 0 total points
ID: 21751541
That gave me "System.Data.DataRowView"


strName = CType(cbReportParam.SelectedItem, DataRowView).Item("Name")
finally got it working
0
 
LVL 19

Expert Comment

by:Stephen Manderson
ID: 21751564
Good to hear it,

Weird I couldnt recreate the problem..

I could get it to show the string with either selectedtext or selecteditem with it being databound

Anyways all the best!
Steve


0
 

Author Comment

by:bertino12
ID: 21751720
Thanks for the time :P
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 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