Link to home
Start Free TrialLog in
Avatar of finance_teacher
finance_teacher

asked on

C# -- ListBox.Items.Insert -- SORTING ?

I dropped a list box onto the page, added the below EVENT, ran the app, clicked anywhere on the APP multiple times, and my listbox got populated.  How can I change the below so NEWEST values appear as the last entry instead of the first entry ?
----------------------------------------------------------------------------------------------------
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            string locationText = String.Format("{0}, {1}", e.X, e.Y);
            listBox1.Items.Insert(0, locationText);
        }
----------------------------------------------------------------------------------------------------
ASKER CERTIFIED SOLUTION
Avatar of jinal
jinal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of p_davis
p_davis

or if you are set on the insert

private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            string locationText = String.Format("{0}, {1}", e.X, e.Y);
            listBox1.Items.Insert(listBox1.Items.Count-1, locationText);
        }