private void LoadInstances()
        {
            var worker = new BackgroundWorker();
            worker.WorkerReportsProgress = true;

            //
            // Enumerates the instances on a background thread
            //
            worker.DoWork += (sender, e) =>
            {
                string name = e.Argument as string;
                worker.ReportProgress(0, "<unnamed>");
                var instances = new PerformanceCounterCategory(name).GetInstanceNames();
                foreach (var item in instances.OrderBy(i => i))
                    worker.ReportProgress(0, item);
            };

            //
            // Adds instances to drop down list
            //
            worker.ProgressChanged += (sender, e) =>
            {
                instanceComboBox.Items.Add(e.UserState);
            };

            //
            // Cleans up UI
            //
            worker.RunWorkerCompleted += (sender, e) =>
            {
                Cursor = Cursors.Default;
                if (instanceComboBox.Items.Count > 0)
                    instanceComboBox.SelectedIndex = 0;
            };

            Cursor = Cursors.WaitCursor;
            counterList.Items.Clear();
            instanceComboBox.Items.Clear();

            worker.RunWorkerAsync(categoryComboBox.SelectedItem);
        }