As in the title, I have a child form with the TopLevel property set to False, and I cannot click on the MaskedTextBox control that it contains (to draw attention to it). I can focus on this using the TAB on the keyboard.
The child form contains other regular TextBox controls, and I can click to focus without problems, although they also exhibit odd behavior: for example, if I have a value in the text box and I try to drag the end of the line to the beginning nothing happens. In fact, I canβt use my mouse to move the cursor inside the TextBox text at all (although they work with keyboard arrows).
I'm not too worried about the strange behavior of the TextBox, but why can't I activate MaskedTextBox by clicking on it?
Below is the code that shows the form:
Dim newReportForm As New Form
Dim formName As String
Dim FullTypeName As String
Dim FormInstanceType As Type
formName = TreeView1.SelectedNode.Name
FullTypeName = Application.ProductName & "." & formName
FormInstanceType = Type.GetType(FullTypeName, True, True)
newReportForm = CType(Activator.CreateInstance(FormInstanceType), Form)
Try
newReportForm.Top = CType(SplitContainer1.Panel2.Controls(0), Form).Top + 25
newReportForm.Left = CType(SplitContainer1.Panel2.Controls(0), Form).Left + 25
Catch
End Try
newReportForm.TopLevel = False
newReportForm.Parent = SplitContainer1.Panel2
newReportForm.BringToFront()
newReportForm.Show()
source
share