I have spent a long time trying to find a solution for the problem I am having with comboboxes within a child form. I'm sure this must be a Microsoft error and not something I'm doing wrong... I would really appreciate some help, Thanks in advance...
The best way to explain the problem would be to tell you what I have done so far:
If you open a new Project in VB and add two Windows Forms. Form1 will be the parent. Form2 will be the child.
On Form1 add 1 x panel(Form2 will open up within the panel so make sure the panel is big enough to fit Form2) and 1 x button. The only code needed for this form is:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
End Sub
On Form2 Add one Textbox and one combobox. Copy the following code into Form2:
Private Sub Form2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
ActivateMdiChild(Me)
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TopLevel = False
Form1.Panel1.Controls.Add(Me)
Me.BringToFront()
End Sub
Now run the program and click button1 to open form2 (form2 should now open within panel1).
The comboboxes and textboxes lose some of there functions for example: 1. You cant set focus on combobox without hitting drop-down 2. You cant highlight text properly in either the combobox or textbox. 3. You cant set the cursor index position using your mouse in the combobox or text box.
Does anyone know a way around this?? Mainly for the combobox as I've got some functions working for the textbox.
Regards, Ben