ACPAddIn.AutoCompleteForm.ListBox1_SelectedIndexChanged C# (CSharp) Method

ListBox1_SelectedIndexChanged() private method

private ListBox1_SelectedIndexChanged ( object sender, System e ) : void
sender object
e System
return void
        private void ListBox1_SelectedIndexChanged(object sender,
        System.EventArgs e)
        {
            if (listBox1.SelectedIndex >= 0)
            {
                previewPanel.Location = new Point(this.Location.X + this.Width - 4, this.Location.Y + 16);
                previewPanel.Visible = true;

                Suggestion currentSuggestion = displaySuggestion[listBox1.SelectedIndex];
                switch (currentSuggestion.type)
                {
                    case Suggestion.SENTENCE:
                        previewPanel.setText(((Sentence)displaySuggestion[listBox1.SelectedIndex]).content);
                        break;
                    case Suggestion.ENTITY:
                        previewPanel.setText(((Entity)displaySuggestion[listBox1.SelectedIndex]).content);
                        break;
                }

            }
            else
            {
                previewPanel.Visible = false;
            }
        }