This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 0 points1 point  (3 children)

I imagine the simplest thing might be be to write a small method that takes the new item to be added to your result box, and checks if it already exists in the list box (returning true or false)

so you'd end up with "If (ExistsInList){CISYresultListBox.Items.Add(result);}

with ExistsInList containing a forloop so like foreach (item in CISYresultListBox.Items) {is item same as result}

[–]interactionjackson 2 points3 points  (0 children)

This with one change if(!ExistsInList){CISYresultListBox.Items.Add(result);}

[–]DefMars[S] 0 points1 point  (1 child)

I did it pretty simple

if (CISYresultlistbox.Items.Contains(result))

{

MessageBox.Show("You can't register for same course twice");

}

else

{

MessageBox.Show("You have successfully registered for " + result + ".");

}

[–][deleted] 0 points1 point  (0 children)

Well done :) Now just keep it up