Can anyone offer an explanation or solution?
Im using VB.net Studio 2005 Pro on Windows XPP (3 similar workstations all do the same).
Simple to describe by way of example.
Add a new form.
Add TextBox1 and TextBox2
Add the following code to the forms class.
Code Block
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
TextBox1.BorderStyle = BorderStyle.Fixed3D
End Sub
Private Sub TextBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Leave
TextBox1.BorderStyle = BorderStyle.None
End Sub
Run the form.
If you click between textboxes USING THE MOUSE it behaves as expected.
That is the border around TextBox1 disappears when you leave, and re-appears when you enter.
But, after you re-enter, you cant move out of TextBox1 using the Keyboard. Eg {TAB} - Why not ?
If you put the code into the corresponding GotFocus & LostFocus events,
Code Block
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
TextBox1.BorderStyle = BorderStyle.Fixed3D
End Sub
Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
TextBox1.BorderStyle = BorderStyle.None
End Sub
you get an error on RE-ENTRY to TextBox1 in the gotfocus event.
System.ComponentModel.Win32Exception was unhandled
ErrorCode=-2147467259
Message="Error creating window handle."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.TextBoxBase.CreateHandle()
at System.Windows.Forms.Control.RecreateHandleCore()
at System.Windows.Forms.TextBoxBase.set_BorderStyle(BorderStyle value)......
Here's hoping someone has the answer (I want to hear) 
Cheers
Geoff