TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Avuya Mxoli
NA
236
209.3k
WPF listbox control
Jul 30 2012 8:43 AM
Hi all,
I have 2listboxes and two buttons. I am trying to move items between these listboxes using buttons. I want to avoid adding the same items more than once to any of the listboxes and here is what I am using which is not working. It just keeps adding and ignores the if statement.
if(listbox2.Items.Contains(listbox1.Items) == true)
{
MessageBox.Show("Items already added");
}
else
{
foreach(var item in listbox1.Items)//Adds ALL items that are in the listbox
{
listbox2.Items.Add(item);
}
Reply
Answers (
7
)
how to export from dataset/datagrid to pdf in c# windows forms:
c#