Create a Windows Forms application using Visual Studio 2010 via New -> Project -> C# Windows Forms Application. Give it the name Quiz5.
Create the following on your main form:
A TextBox called txtItemToAdd.
A Button called btnAdd with text "Add Item" on it.
A ListBox called lbItems with MultiSimple selection mode.
A Button called btnDelete with text "Delete Item(s)" on it.
Do the following with what you’ve created:
Create an Event Handler for the btnAdd clicked event that does the following:
Takes the text value from txtItemToAdd and Validates it using the ValidateItem method.
If validated add the text value as a new item in the lbItems list Items collection.
Create an Event Handler for the btnDelete clicked event that does the following:
Goes through every item in the lbItems ListBox and removes it if it is selected.
Create a ValidateItem() method that does the following:
Takes a string parameter and returns a Boolean.
Ensures the string parameter is not an empty string or return false.
Goes through the lbItems, Items collection and makes sure that the string parameter does not match any of the string items there already, return false if it does.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.