Cannot change TOP/HEIGHT of tab control.

G

Guest

For various reasons I want to cahnge the height and top values of a tab
control as pages are selected.

The design values in twips are:
TabCtl.Top = 5430
TabCtl.Height = 3465

When I click on tab 5 (tabctl.value=5) I change the properties to:
TabCtl.Top = 5430
TabCtl.Height = 3465
and it works well.

When I press one of the other tabs it fails with the following error message:
Run-time error 2100 "The control or subform control is too large for this
location."

The code I use is:

If TabCtl.Value <> 5 Then
TabCtl.Height = 2835
TabCtl.Top = 6060
Else
TabCtl.Top = 5430
TabCtl.Height = 3465
End If

Notice if value<>5 that I reduce the Height BEFORE increasing Top property.

If I break at "TabCtl.Top = 6060" the Height is still 3465 and NOT 2835.

Is this weird or what?
 
M

Marshall Barton

ThomasAJ said:
For various reasons I want to cahnge the height and top values of a tab
control as pages are selected.

The design values in twips are:
TabCtl.Top = 5430
TabCtl.Height = 3465

When I click on tab 5 (tabctl.value=5) I change the properties to:
TabCtl.Top = 5430
TabCtl.Height = 3465
and it works well.

When I press one of the other tabs it fails with the following error message:
Run-time error 2100 "The control or subform control is too large for this
location."

The code I use is:

If TabCtl.Value <> 5 Then
TabCtl.Height = 2835
TabCtl.Top = 6060
Else
TabCtl.Top = 5430
TabCtl.Height = 3465
End If

Notice if value<>5 that I reduce the Height BEFORE increasing Top property.

If I break at "TabCtl.Top = 6060" the Height is still 3465 and NOT 2835.

Is this weird or what?


Not weird. Actually, that's to be expected unless your tab
control has a lot of unused space on **all** of its pages.
The key to this issue is that you can not reduce the Height
to less than the value required to display all of its
controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top