Home » SQL ServerRSS

Combobox + Textbox in GroupBox

In my project, which search data from my database, I have some parameters for searching. For each parameter I have a pair: combobox with a list of parameters for the selection and textbox to display the selected parameter.
All this works fine.
But when I put such a pair (combobox + textbox)  in a groupbox, I get a searching without this parameter. If I put the combobox + textbox out of  the groupbox again , then everything works fine.

I can solve this without groupboxes but I am interested in why this happens?



4 Answers Found


Answer 1

You haven't explained how you are extracting the data out of your controls.

Are you using the Find method?  That doesn't look deeply through nested controls. You need to run that on the GroupBox, not the Form.  (It is also possible to write a more powerful "recursive" Find method that looks through everything... write back if you need more help.)




Answer 2

For me it is  difficult to understand what you say. Maybe I can ask more generally:         Is there a difference in the behavior of controls if they are located within or outside the  groupbox?

Thanks. Zlatkodo


Answer 3

No. Those controls should not behave any differently based on their container.

What does change is how to find them as BC mentioned.

If you look for the controls on the form, you won't find them because the controls are stored in a hierarchy based on their container. See this link for more information.


Hope this helps.


Answer 4

I still need a little help, please. Part of my code for Form1 is next:



ForEach ctl As Control InMe.Controls


IfTypeOf ctl Is TextBox Then


If ctl.Text <> ""And ctl.Tag.ToString <> "Di"And ctl.Tag.ToString <> "L"And ctl.Tag.ToString <> "kW"Then

clausestring = clausestring &

CStr(ctl.Tag) & " = @" & CStr(ctl.Tag) & " and "


"@" & ctl.Tag.ToString, ctl.Text)











 How the code should look like if I want to search:
- full Form1 including all GroupBoxes? 

- just GroupBoxes ?
Thanks in advance.



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter