0
如何防止SelectedIndexChanged在我添加新项目时触发列表框?它触发我添加的每个项目。列表框当我添加项目时触发它自己
private void lb_accounts_SelectedIndexChanged(object sender, EventArgs e)
{
var selectedProperty = (KeyValuePair<string, string>)lb_accounts.SelectedItem;
fb.AccessToken = selectedProperty.Key;
dynamic albums = fb.Get("/me/albums");
Dictionary<string, string> list = new Dictionary<string, string>();
foreach (dynamic album in albums.data)
{
list.Add(album.id, album.name);
}
lb_albums.DataSource = new BindingSource(list, null);
lb_albums.DisplayMember = "Value";
lb_albums.ValueMember = "Key";
}
你的问题不清楚或你的代码片段是不相关的?你想防止发射选择的索引改变事件的列表框? – PawanS