Hi
I found lot of messages in this group on this issue but nothing
actually explains it quite clearly.
I've a user control with a text box and a list view.
When i set the focus to the user control i want that the list view's
1st item be selected and should look in blue. However there's no way i
can override on what should happen when Focus() is called on my user
control.
any solutions/ workaround to this problem would really help.
Thanks, Abhishek
DeveloperX - 20 Jul 2007 13:12 GMT
> Hi
>
[quoted text clipped - 10 lines]
>
> Thanks, Abhishek
Not sure what you wanted in blue, the listview or the selected item,
so I did the listview. It's the Enter and leave events you're
interested in.
private void UserControl1_Leave(object sender, System.EventArgs e)
{
listView1.BackColor = Color.White;
}
private void UserControl1_Enter(object sender, System.EventArgs e)
{
listView1.BackColor = Color.Aqua;
listView1.TopItem.Selected = true;
}
Manish Bafna - 20 Jul 2007 13:16 GMT
Hi,
Although i am not sure but you can try this.User FindControl method of
usercontrol and getreference to listbox or for that matter any other control
residing inside UserControl and then call focus method of that control.For
example something like this:
((ListBox)(UserControl1.FindControl("ListBox1")).Focus;
This is not exact syntac but you might have got an idea.

Signature
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
> Hi
>
[quoted text clipped - 10 lines]
>
> Thanks, Abhishek