将一组行添加到ListBox

时间:2017-03-21 21:26:14

标签: c# listbox

我想在列表中添加一组行,并且包含以下错误代码:

StatusBox.Items.Insert(0, "-".PadRight(this.StatusBox.Width,'-'));
StatusBox.Items.Insert(0, "Total search results: 0");
StatusBox.Items.Insert(0, "Searching database: " + Dropdown1Selection.SelectedItem.ToString());
StatusBox.Items.Insert(0, "Searching server: " + Dropdown2Selection.SelectedItem.ToString());

StatusBox的类型为ListBox。上面的代码是我在添加单行文本时看到所需结果的结果。但现在它是一组行,看起来像是:

enter image description here

1 个答案:

答案 0 :(得分:0)

在ListBox的属性中,我不得不更改" Sorted"属性为False:

enter image description here