I am trying to emulate the way Windows Explorer allows you to rename files by clicking on them, but in a Treeview. So, I am putting a panel on the treeview, and when they click correctly, I place it in the correct place.

However, I am trying to get the focus placed on the Textbox so I can SelectAll of the text. But, it isn't working because (as I found from debug statements) after the textbox grabs the focus, the treeview grabs it back. I can then click on it and everything works fine, but the focus not staying on the textbox is causing problems, and it just doesn't behave like Windows Explorer does.

Here is the code, am I missing anything fundamental?
Me.Panel1.Visible = True
Me.Panel1.BringToFront()
Me.TextBox1.Focus()
Me.TextBox1.SelectAll()
This is the tail end of the Mouse_Up Event of the Treeview. Like I said, everything works except that the treeview grabs focus after the Mouse_Up Event terminates, and I can't figure out why. Nothing else should be happening. Anybody know what I am doing wrong?

Thanks