I have a list box on a Windows form in Visual Studio 2010 and would like the user to click a button and have the items in the list box sorted. E.g Alphabetical Order, Numerical Order.
I am new to C# and aren't sure where to start with writing the code for the sort button. I would very much appreciate if you could provide me with a starting point how to go about doing this.
This is the data for the list box when data is being added to it:
public Sale GetItemData()
{
Sale newItem = new Sale(Convert.ToInt32(txtID.Text), StartingDate.Text, ClosingDate.Text, txtLocation.Text, Convert.ToInt32(txtDisplaySpaces.Text), txtExclusive.Text, txtME.Text, Convert.ToInt32(txtDisplayStands.Text));
return newItem;
}
This is the sort by ID button that I wish to use to sort the list box:
private void btnSortSalesbyID_Click(object sender, EventArgs e)
{
}
Thanks.