troubleshooting Question

Combo box with Multiple Value Member in Win Form

BALMUKUND KESHAVFlag for India asked on
.NET ProgrammingVisual Basic.NETMicrosoft Development
6 Comments1 Solution3869 ViewsLast Modified:
Hi Experts,
I have the below codes to populate a combo box and getting Value Member as Vend_cd after combo box selected index change. My problem is a want two values as a Value Member, as i know combo box have single display member and value member. I also know i can conconate two columns and can used as a display member or may be as value member too.

I want to get unit alongwith vend_cd after combobox selected index change event.
How can i do this. Please advise.

     Dim dataset As New DataSet
      Dim adapter As New SqlDataAdapter()
      adapter.SelectCommand = New SqlCommand("select distinct vend_item.vend_Cd,vend_item.Unit,vendor.vend_name from vend_item inner join vendor on vend_item.vend_cd=vendor.vend_Cd where vend_item.item_cd in (" + selectedVendor.ToString + ")", myconn)
  If myconn.State = ConnectionState.Closed Then myconn.Open()
   CmbVendor.DataSource = dataset.Tables(0)
    CmbVendor.DisplayMember = "Vend_name"
     CmbVendor.ValueMember = "Vend_cd"

Bm Keshav
Trideep Patel
Project Lead

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros