Please help with ChangeParent

skipper

Member
Licensed User
My app has 2 forms. Form1 contains an invisible ComboBox (a kind of "global" combobox that should be used eveywhere) and a Button switching to Form2.

Form2 contains a Panel containing a TextBox. When TextBox1 get the focus, I would like to show the ComboBox. At the same time I would like to be able to move the ComboBox from a parent to another. I following code does not work (also placing TextBox directly on Form2, without the second ChangeParent instruction). I'm sure I'm wrong. Is someone there that could give me please some guidelines?

Sub Globals
'Declare the global variables here.
End Sub

Sub App_Start
Form1.Show
frmlib.New1 ("Form1",B4PObject(1))
frmlib.ChangeParent ("ComboBox1","Form2")
frmlib.ChangeParent ("ComboBox1","Panel1")
End Sub

Sub Button1_click
Form2.Show
End Sub

Sub Text1_GotFocus
Combobox1.Width =TextBox1.Width
ComboBox1.Top =TextBox1.Top
ComboBox1.Left =TextBox1.Left
ComboBox1.BringToFront
ComboBox1.Visible=True
End Sub
 
Top