I've spent three days trying to get a user control to do some obvious things -- show, hide, and focus among other things. Done in vBASIC in Visual Studio 2010 Pro. The calling program is a Windows Forms Application, while the user control is a WPF Custom Control Library with a single object, a textbox. The reason it's a user control is that this textbox is connected to an async serial device; the reason it's in a Custom Control Library is that I'd like to be able to drop this functioning serial-port-connected textbox into future projects.

No matter what syntax I attempt, the user control (neither the control nor the text box inside it) will Hide(). I've tried every variation I can think of with control.Visible = false, exposing public subs to do the work, etc. When the form appears and characters are typed in the field, the KeyPress routine is functioning -- it will only accept numeric digits.

Here's the vastly reduced code to illustrate the problem:

Calling Windows Forms Application Code:

Imports DTRFormsControlLibrary2

Public Class Form1

Dim sbControl As ucDTRScanBox

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
sbControl = New ucDTRScanBox()
sbControl.Hide()
End Sub

End Class

Responding WPF Custom Control Library code:

Public Class ucDTRScanBox

Public Sub New()
InitializeComponent()
End Sub

Private Sub sbRFIDTag_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles sbRFIDTag.KeyPress
If Not IsNumeric(e.KeyChar) Then e.Handled = True
End Sub
End Class

In spite of the call to sbControl.Hide(), the form opens with a very visible and enabled user control text box. The ability to control visibility, focus, and enable/disable seems fundamental to any control. It shouldn't be this hard. What am I missing?

TIA to anyone who's dealt with this and is willing to set me straight...