Forum  General Visual ...  Let's Chat Abou...  Combo box issue
Previous Previous
 
Next Next
New Post 4/21/2009 8:42 PM
  seeker_01
8 posts
No Ranking


Combo box issue 

Hi,

I had two combo boxes that are databound to the same array of objects.

So both combo boxes has the same list of objects, but they are to be independent of each other on the same form

I had the second combobox with the event SelectIndexChanged.

Somehow whichever combobox index is changed, the other will follow.

This two same selections still happened even without the SelectedIndexChanged event

Has anyone had this problem before?

 
New Post 4/21/2009 10:22 PM
  jayhobbs
1644 posts
1st Level Poster




Re: Combo box issue 

Hi,

You need to have two separate data sources defined

Public Class Form2
    Dim DS As New NorthwindDataSet
    Dim DtCust As New NorthwindDataSet.CustomersDataTable
    Dim DtCust2 As New NorthwindDataSet.CustomersDataTable
    Dim DACust As New NorthwindDataSetTableAdapters.CustomersTableAdapter

    Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        DACust.Fill(DtCust)
        DACust.Fill(DtCust2)
        ComboBox1.DataSource = DtCust
        ComboBox1.DisplayMember = "CompanyName"
        ComboBox1.SelectedIndex = 0
        ''
        ComboBox2.DataSource = DtCust2
        ComboBox2.DisplayMember = "CompanyName"
        ComboBox2.SelectedIndex = 0
    End Sub
End Class

I hope this helps

Jay

 

 
New Post 4/21/2009 10:51 PM
  seeker_01
8 posts
No Ranking


Re: Combo box issue 

Right, two different sources.
Should have figure this one out...

Thanks, Jay.

 
New Post 4/22/2009 7:06 AM
  dubem1
1044 posts
1st Level Poster




Re: Combo box issue 
Modified By dubem1  on 4/22/2009 9:07:25 AM)

I have face the same situation and I have used a clone

 ComboBox1.DataSource = myDataSource

 ComboBox2.DataSource = myDataSource.Clone

Martin

 
New Post 4/23/2009 1:55 PM
  palli
11189 posts
1st Level Poster




Re: Combo box issue 

Thanks for your input Martin,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  Let's Chat Abou...  Combo box issue
Azure banner
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS