DraguVaso <(E-Mail Removed)> wrote:
> I have 2 comboboxes, both bound to a different DataView, but thoe DataViews
> are bound to 1 DataTable in 1 DataSet.
> Like this:
>
> Dim dvwList2 As New DataView
> dvwList2 = MyDataSet.Tables("tblAccounts").DefaultView
> dvwList2.Sort = "Account ASC"
> cmbAccount.DataSource = dvwList2
> cmbAccount.DisplayMember = "MaskAccount"
> cmbAccount.ValueMember = "Account"
> cmbAccount.Text = ""
>
> Dim dvwList3 As New DataView
> dvwList3 = MyDataSet.Tables("tblAccounts").DefaultView
> dvwList3.Sort = "doccode ASC"
> cmbDocCode.DataSource = dvwList3
> cmbDocCode.DisplayMember = "doccode"
> cmbDocCode.ValueMember = "Account"
> cmbDocCode.Text = ""
>
> The problem is: The sorting on the second DataView changes also the sorting
> on the first DataView, so both are Sorted by "doccode ASC".
>
> Why does this happen? I dodn't want my View to change things like that. Is
> there a way to get arround this? Or Should I fill my Comboboxes another way?
Those aren't two views - they're one view. When you use DefaultView,
that's a single view. If you want to make sure you use a different
view, use the DataView constructor.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too