In my project, in a form there are two list views in the tabcontrol, i am unable to set the focus to both the list view items. I am using the following code. The problem is that I am able to select only one listview among the both. Please tell me what is the alternative I can do to select both the listviews in the form.
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
BindData1();
if (listViewClients.Items.Count > 0)
{
listViewClients.Items[0].Selected = true;
listViewClients.Select();
}
if (listView1.Items.Count > 0)
{
listView1.Items[0].Selected = true;
listView1.Select();
}
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
BindData1();
switch (this.tabControl1.SelectedTab.Name)
{
case "tpUpdate":
listViewClients.Items[0].Selected = true;
listViewClients.Select();
break;
case "tpDelete":
listView1.Items[0].Selected = true;
listView1.Select();
break;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.