Comboboxes sharing SelectedValue
HELP! Please, thank you...
I have a NETCF form, in VB.NET 2005, ...
Both comboboxes are bound to the same DataTable object,
OK... i figured out a way around my problem... though it seems a bit kludgy,
and doesnt make a bit of sense to me...
but i am going to post it anyway, in case others run into this same problem.
I have the two comboboxes, both bound to the same DataTable for their drop
down list values.
My problem was, that programmatically setting or getting the SelectedValue
property affected BOTH combo boxes.
so if i set the SelectedValue on one box, it set both of them...
and if i read the SelectedValue from either box, i got the same value,
regardless of what was actually selected on-screen.
Apprently it has something to do with both drop down lists being populated
from the same datatable.
I was able to "fix" this by doing the following...
cbo1.DataSource = myDataTable
cbo2.DataSource = myDataTable.Copy()
where before i had been doing this...
cbo1.DataSource = myDataTable
cbo2.DataSource = myDataTable
Whatever... it works, and that's good, though i would think it uses up extra
memory this way. *shrug*
Date:Thu, 26 Jul 2007 11:18:27 -0400
Author:
|