473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Overlapping Group Boxes

I am having a strange issue with an application written in .NET 2.0.
Actually it is in VB.NET but I think my problem is not language
specific, but a .NET Framework issue.

On a form I have a Combo Box populated with two items. There are two
Group Boxes on the form with different sets of controls in each. They
both are the same size and are located at the same place. Which Group
Box is visible depends on the item selected in the combo box.

I have found that switching the visible property between them in the
combo box's selectedindexchanged event only works if the group box
that starts off as not visible is "under" the group box that starts
off as visible. If they are the other way around, the group box now on
the bottom will never appear.

Any ideas?

Sep 25 '07 #1
5 4806
On Sep 25, 10:27 am, za...@construction-imaging.com wrote:
I am having a strange issue with an application written in .NET 2.0.
Actually it is in VB.NET but I think my problem is not language
specific, but a .NET Framework issue.

On a form I have a Combo Box populated with two items. There are two
Group Boxes on the form with different sets of controls in each. They
both are the same size and are located at the same place. Which Group
Box is visible depends on the item selected in the combo box.

I have found that switching the visible property between them in the
combo box's selectedindexchanged event only works if the group box
that starts off as not visible is "under" the group box that starts
off as visible. If they are the other way around, the group box now on
the bottom will never appear.

Any ideas?
I'd hate to say this, but I can't reproduce this here. Here's what I
did:

Created New WinForms project
Added Combobox (ComboBox1)
Added two item's to ComboBox1's items collection ("A" and "B")
Added GroupBox (GroupBox1)
Added GroupBox (GroupBox2)
Set GroupBox2's location equal to GroupBox1's location
Set GroupBox2's Visible property equal to False
Added the following to ComboBox1's SelectedIndexChanged:

If Me.ComboBox1.Text = "B" Then
Me.GroupBox1.Visible = False
Me.GroupBox2.Visible = True
Else
Me.GroupBox1.Visible = True
Me.GroupBox2.Visible = False
End If

Everything appears to work fine, the GroupBox's are swapping places
just fine. Did I do something wrong in my steps?

Thanks,

Seth Rowe

Sep 25 '07 #2
On Sep 25, 11:29 am, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Sep 25, 10:27 am, za...@construction-imaging.com wrote:


I am having a strange issue with an application written in .NET 2.0.
Actually it is in VB.NET but I think my problem is not language
specific, but a .NET Framework issue.
On a form I have a Combo Box populated with two items. There are two
Group Boxes on the form with different sets of controls in each. They
both are the same size and are located at the same place. Which Group
Box is visible depends on the item selected in the combo box.
I have found that switching the visible property between them in the
combo box's selectedindexchanged event only works if the group box
that starts off as not visible is "under" the group box that starts
off as visible. If they are the other way around, the group box now on
the bottom will never appear.
Any ideas?

I'd hate to say this, but I can't reproduce this here. Here's what I
did:

Created New WinForms project
Added Combobox (ComboBox1)
Added two item's to ComboBox1's items collection ("A" and "B")
Added GroupBox (GroupBox1)
Added GroupBox (GroupBox2)
Set GroupBox2's location equal to GroupBox1's location
Set GroupBox2's Visible property equal to False
Added the following to ComboBox1's SelectedIndexChanged:

If Me.ComboBox1.Text = "B" Then
Me.GroupBox1.Visible = False
Me.GroupBox2.Visible = True
Else
Me.GroupBox1.Visible = True
Me.GroupBox2.Visible = False
End If

Everything appears to work fine, the GroupBox's are swapping places
just fine. Did I do something wrong in my steps?
I appreciate you being so thorough. The only difference I can see is
that the default visible property for both group boxes is true. The
visble property of the group box that isn't the "default" is set to
false in the form's Load event. Can't really say how that could cause
things to be different, though.

Also, again don't know if it makes a difference, but both group boxes
in my app have several controls, a mix of comboboxes, textboxes,
checkboxes and command buttons.

Sep 25 '07 #3
Could it be that one groupbox is actually owned by the other groupbox
instead of the parentform?

You can check that using the Class View window (View|Class View)

There you should see your form (eg. Form1 or whatever). If you click that
you can see all the controls in Form1 (amongst other things). There you
should be able too see both Groupboxes. What I suspect is that you will only
see one of them, and if you click that one, you will see the other one as a
child control of the first one.

It's easily done if you arrange your controls using drag and drop.

If that's not the problem, I'm afraid I haven't got a clue... ;-) Then you
might have to post some cod efor us to look at.

Cheers,
Johnny J.


<za***@construction-imaging.comskrev i meddelandet
news:11**********************@50g2000hsm.googlegro ups.com...
>I am having a strange issue with an application written in .NET 2.0.
Actually it is in VB.NET but I think my problem is not language
specific, but a .NET Framework issue.

On a form I have a Combo Box populated with two items. There are two
Group Boxes on the form with different sets of controls in each. They
both are the same size and are located at the same place. Which Group
Box is visible depends on the item selected in the combo box.

I have found that switching the visible property between them in the
combo box's selectedindexchanged event only works if the group box
that starts off as not visible is "under" the group box that starts
off as visible. If they are the other way around, the group box now on
the bottom will never appear.

Any ideas?

Sep 25 '07 #4
JB
On 25 Sep, 21:04, "Johnny Jörgensen" <j...@altcom.sewrote:
Could it be that one groupbox is actually owned by the other groupbox
instead of the parentform?

You can check that using the Class View window (View|Class View)

There you should see your form (eg. Form1 or whatever). If you click that
you can see all the controls in Form1 (amongst other things). There you
should be able too see both Groupboxes. What I suspect is that you will only
see one of them, and if you click that one, you will see the other one asa
child control of the first one.

It's easily done if you arrange your controls using drag and drop.

If that's not the problem, I'm afraid I haven't got a clue... ;-) Then you
might have to post some cod efor us to look at.

Cheers,
Johnny J.

<za...@construction-imaging.comskrev i meddelandetnews:11**********************@50g2000hs m.googlegroups.com...
I am having a strange issue with an application written in .NET 2.0.
Actually it is in VB.NET but I think my problem is not language
specific, but a .NET Framework issue.
On a form I have a Combo Box populated with two items. There are two
Group Boxes on the form with different sets of controls in each. They
both are the same size and are located at the same place. Which Group
Box is visible depends on the item selected in the combo box.
I have found that switching the visible property between them in the
combo box's selectedindexchanged event only works if the group box
that starts off as not visible is "under" the group box that starts
off as visible. If they are the other way around, the group box now on
the bottom will never appear.
Any ideas?
Hi,

I had similar problems with overlapping panels and group boxes.
To be sure one group box isn't owned by the other go to the
yourForm.designer.vb file which is automatically generated.
In there just search for reference to you Group Box. If you see a line
like Me.GrpBx1.Controls.Add(Me.GrpBx2) that means that GrpBx2 is
actually owned by GrpBx1.
It often happens when you place your controls at the same position
with the GUI.
Just remove that line from the file and replace it with something like
Me.Controls.Add(Me.GrpBx2). Then GrpBx will be owned by the form
instead.

JB
Sep 26 '07 #5
If you have not yet resolved this...

Try this
In the form designer, set the GroupBoxes apart, to be sure one does not own
the other. In form_load, set the location and size properties of one equal
to the other. In the ComboBox selectectedindexchanged event, use the
BringToFront method of the combobox you want to show. You won't have to use
the visible properties.
"za***@construction-imaging.com" wrote:
I am having a strange issue with an application written in .NET 2.0.
Actually it is in VB.NET but I think my problem is not language
specific, but a .NET Framework issue.

On a form I have a Combo Box populated with two items. There are two
Group Boxes on the form with different sets of controls in each. They
both are the same size and are located at the same place. Which Group
Box is visible depends on the item selected in the combo box.

I have found that switching the visible property between them in the
combo box's selectedindexchanged event only works if the group box
that starts off as not visible is "under" the group box that starts
off as visible. If they are the other way around, the group box now on
the bottom will never appear.

Any ideas?

Sep 28 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Max M | last post by:
I am writing a "find-free-time" function for a calendar. There are a lot of time spans with start end times, some overlapping, some not. To find the free time spans, I first need to convert the...
3
by: Phil Sandler | last post by:
All, I have a table with start and end dates/times in it, and would like to be able to calculate the number of hours represented, accounting for overlapping records. Note that I am looking...
3
by: Yasaswi Pulavarti | last post by:
In a html page I have <form>, <table> and <td> tags overlapping each other. Will this cause some browsers to not render the page as intended? Thanks, Yasaswi
5
by: Mystilleef | last post by:
Hello, Is there a simple flag to set to allow overlapping matches for the findall() regular expression method? In other words, if a string contains five occurrences of the string pattern "cat",...
5
by: Gernot Frisch | last post by:
Hi, I have a site: http://www.glbasic.com/bugs.htm where 2 divs (class = "outer") overlap in Firefox. In IE it looks good (although the text part has a too large distance from the header...)...
3
by: Rehceb Rotkiv | last post by:
In the re documentation, it says that the matching functions return "non- overlapping" matches only, but I also need overlapping ones. Does anyone know how this can be done? Regards, Rehceb...
2
by: monadel | last post by:
I have a problem with checking the overlapping date. Basically I am developing a database using MS Access (VB scripts) and SQL queries. I have 2 tables which are empTable and empLeaveTable. In a...
5
by: zacks | last post by:
I am having a strange issue with an application written in .NET 2.0. Actually it is in VB.NET but I think my problem is not language specific, but a .NET Framework issue. On a form I have a...
0
by: Shawn Northrop | last post by:
I am trying to understand overlapping layers and am having some trouble. www.jeanneflight.com/funtrips/index.php I would like the two red boxes to fit next to each other inside of the "bot" div....
5
by: Hendrik Maryns | last post by:
Hi, At this website: http://tcl.sfs.uni-tuebingen.de/~hendrik/keyboard.shtml, just below the section ‘Sample .xmodmap file’, you see some keys which are modeled with <kbd>. The border...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.