Listboxes with Databindings

J

Joerg

Hi!
I've two list boxes, both bind to different datasources (Datatable),
but showing the same MemberValue (UserID)
The listboxes are placed in a form which shows detail information from
a datagrid about the actual selected row. The left box shows the
avaible users, the right one the users added to actual selected row in
the datagrid.
When I select an Item in the left box and then click on a button, I
want that the Item is added to the right. On the left it should not be
anymore avaible.
Showing the items in the right box is not a problem, because it's a
related table to the datagrid. But how can I show only the users that
are not in the right box, when this box is bounded to whole user
datable (which has now relation)?

Thanks for help!
 
M

Morten Wennevik [C# MVP]

Hi!
I've two list boxes, both bind to different datasources (Datatable),
but showing the same MemberValue (UserID)
The listboxes are placed in a form which shows detail information from
a datagrid about the actual selected row. The left box shows the
avaible users, the right one the users added to actual selected row in
the datagrid.
When I select an Item in the left box and then click on a button, I
want that the Item is added to the right. On the left it should not be
anymore avaible.
Showing the items in the right box is not a problem, because it's a
related table to the datagrid. But how can I show only the users that
are not in the right box, when this box is bounded to whole user
datable (which has now relation)?

Thanks for help!

Hi Joerg,

I'm not sure I completely follow you, if you move a user from the left ListBox to the right one, can't you just delete that entry from the left DataSource (or set a value on some column that you can filter by)?
 
J

JagdPanther

Hi!
I've two list boxes, both bind to different datasources (Datatable),
but showing the same MemberValue (UserID)
The listboxes are placed in a form which shows detail information from
a datagrid about the actual selected row. The left box shows the
avaible users, the right one the users added to actual selected row in
the datagrid.
When I select an Item in the left box and then click on a button, I
want that the Item is added to the right. On the left it should not be
anymore avaible.
Showing the items in the right box is not a problem, because it's a
related table to the datagrid. But how can I show only the users that
are not in the right box, when this box is bounded to whole user
datable (which has now relation)?

Thanks for help!

Hello Joerg,

I'm not sure I follow you either, and I'm also kind of new to .NET
programming..! But I just wanted to mention that I spent many hours
trying to figure out how to use ListBox:es as well, when I suddenly
realised that the ListView component offers much more flexibility =)
So I was just thinking, maybe you want to use two ListView:s instead??

/JagdPanther
 
J

Joerg

No I can't delete the entry from the data source, because when I move
to the next record in the datagrid, I mus refresh the values,
depending what is shown on the right.
but a filter could be a good idea

Hi!
I've two list boxes, both bind to different datasources (Datatable),
but showing the same MemberValue (UserID)
The listboxes are placed in a form which shows detail information from
a datagrid about the actual selected row. The left box shows the
avaible users, the right one the users added to actual selected row in
the datagrid.
When I select an Item in the left box and then click on a button, I
want that the Item is added to the right. On the left it should not be
anymore avaible.
Showing the items in the right box is not a problem, because it's a
related table to the datagrid. But how can I show only the users that
are not in the right box, when this box is bounded to whole user
datable (which has now relation)?
Thanks for help!

Hi Joerg,

I'm not sure I completely follow you, if you move a user from the left ListBox to the right one, can't you just delete that entry from the left DataSource (or set a value on some column that you can filter by)?

--
Happy coding!
Morten Wennevik [C# MVP]- Zitierten Text ausblenden -

- Zitierten Text anzeigen -
 
J

Joerg

Thanks JagdPanterh
No, the listview is not the correct control tho show the items I have
in the datasource. I only want show users and move them from on box to
the other.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top