how to set focus to a treeview on form load

A

adiel

Hello, I noticed when my page loads that when I pass the mouse over an
element in the treeview, the colors are lighter. Then I realized if I
click in an empty area inside the treeview, the colors are now darker
when I mouse over an element. The problem is of course that the
treeview does not have focus when the form loads. My question is, how
do I set focus to the treeview when the form loads?

I guess I am looking for something like:

TreeView1.Focus

But such property does not exist. Has anyone been able to set focus
to the microsoft treeview when the form is first loaded?

Thanks before hand,
Adiel
 
E

Eidolon

Well, this is not the exACT code youd be looking for, but it may help... i
would *guess* you would simply need to replace "txtID" with the ID of your
treeview.

'Set the script to focus and select the TextBox
RegisterStartupScript("focus", "<script language=""JavaScript"">" & vbCrLf
& _
vbTab & "Form1." & txtID.ClientID & ".focus();" & _
vbCrLf & vbTab & "Form1." & txtID.ClientID & ".select();" & _
vbCrLf & "<" & "/script>")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top