当前位置: 动力学知识库 > 问答 > 编程问答 >

compact framework - Finish control loading

问题描述:

I've a method which fill a combobox. (compact framework 3.5)

lstNiveaux.BeginUpdate();

lstNiveaux.Items.Clear();

for (int i = 0; i < list.Count; i++)

{

var item = new ListViewItem(list[i].value);

lstNiveaux.Items.Add(item);

}

lstNiveaux.EndUpdate();

I want to do :

lstNiveaux.Items[10].Selected = true;

lstNiveaux.EnsureVisible(10);

When I write that piece of code at the end of the previous method, it won't work but ... if I put a button with a click event, and the piece of code inside, it will work.

I tryied Application.DoEvents, Thread.Sleep and other stuff but no work. Does someone has a solution ?

regards

分享给朋友:
您可能感兴趣的文章:
随机阅读: