samsmithnz Posted March 18, 2005 Posted March 18, 2005 I have a Dynamic listbox that I am creating, it's going to be a sort of popup list that you can select from and filters as you're typing. It all works pretty well, except that it's always in the back and a .BringtoFront doesn't seem to do ANYTHING. Anyone have a clue what I'm doing wrong? 'add the dropdown list lstDropDown = New ListBox With lstDropDown .Top = txtDisplayTextBox.Top + txtDisplayTextBox.Height .Left = txtDisplayTextBox.Left .Height = 95 .Width = txtDisplayTextBox.Width .Visible = True .BringToFront() End With frmParent.Controls.Add(lstDropDown) Quote Thanks Sam http://www.samsmith.co.nz
The Red Duke Posted March 18, 2005 Posted March 18, 2005 I don't know why it won't come to the front... But I do have one alternative suggestion I got from looking at the C# Express 2005 Beta IDE (they have a small graphical bug where the intellisence popup is in a form with no title or control box so it�s just the form and resizing handles with a list-box set to fill the form) But the list-box looks like it is set to the full height of the form because it�s missing the 4 pixels not accounted for by the resizing handles on the borders. Anyway you could try putting your list-box in a form with no title or control box. That way you could give it the ability to be resized too and you should have no trouble bringing it to the front. P.S. Sorry if that�s not what you meant. The Red Duke Quote
Wile Posted March 18, 2005 Posted March 18, 2005 One suggestion I can make. I've used (in C# but that shouldnt matter) the BringToFront method and it did work, but I added the control to the forms collection of controls before calling BringToFront. So maybe you can change that.. Would be something like this: ...... bit of code i didnt bother with copying ;). .Width = txtDisplayTextBox.Width .Visible = True End With frmParent.Controls.Add(lstDropDown) lstDropDown.BringToFront() Quote Nothing is as illusive as 'the last bug'.
Leaders snarfblam Posted March 19, 2005 Leaders Posted March 19, 2005 Yeah, you do need to add it to the control collection before bringing it in front. Otherwise it does not have a collection of controls that it can be brought in front of. Quote [sIGPIC]e[/sIGPIC]
samsmithnz Posted March 19, 2005 Author Posted March 19, 2005 Ahh yes, that works. I knew it was something simple and logical. :rolleyes: Cheers guys! :D Quote Thanks Sam http://www.samsmith.co.nz
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.