Weird Tab control situation here...

UCM

Centurion
Joined
Jan 1, 2003
Messages
135
Location
Colorado, usa
Hey guys...

I am working on a new project with the tab control object and an axwebbrowser object...

One thing I want to allow the user to do is to change the positioning of the tabs on the tab control ( top, right, bottom, left ) at run time...

I have tabcontrol1 with tabpage1 and AxWebBrowser1 is on tabpage1...

When the program starts, it comes up fine, but when I change the tab alignment property on the tabcontrol1 object ( at run time ) then the tab will move to the desired place...

The problem is that when the tabs omve, the axwebbrowser object disappears and I cant get it back...

I've tried:
tabpage1.sendtoback()
axwebbrowser1.bringtofront()

Any ideas??
 
I don't understand why but if you set its Visible property to True it will be displayed again. Why it's being hidden is anyones guess!
 
Does the WebBrowser control have its Dock property set to Fill? Does it work with other controls embedded, i.e. a textbox or something?
 
Yes the webbrowser control is set to fill....and I haven't tried other controls yet...

When I get back home, i'm going to try the ideas you've all had...

Its so weird though, any idea why it does that?
 
You piqued my curiosity... and, true enough, when changing tab alingment in code only the WebBrowser seems to disappear. You can fix it by setting the Visible property to true after you change the tab's Alignment. Other controls, such as a checkbox, seemed to work just fine after the alignment switch. Go figure :)

-nerseus
 
Just an update...

I used the following code to see what happens ( a little ):
Visual Basic:
    Me.TabControl1.Alignment = TabAlignment.Left
    Me.Text = Me.AxWebBrowser1.Visible.ToString
This code proved that once the tabalignment is changed then the AxWebBrowser object is automatically made invisible...

It's probably a minor defect that Microsoft overlooked

Of course, just like all of you said, setting the visible property to True after changing the tabalignment corrects the issue...

Hope MS gets dat fixed in the next .net framework release...
 
Anyone know a 3rd party tabcontrol???

U know...This is definately NOT cool :-/

It does it not only at run time but in the designer as well...

As near as I can figure, the tabcontrol will make it's panel object ( the one that microsoft put in the control along with the tabstrip control ) the top most object over axtive x controls like the axwebbrowser...

Setting many many lines of code in all the right areas to make the axwebbrowser object 'visible' at run time isn't very plausable, Especially since it's whenever you change anything in the tabcontrol ( like adding a tab for instance :-/ )

It's totally screwy... If all else fails, I will just have to break down and create my own tabcontrol from scratch ( talk about work, oyy )
 
I'm not sure how feasable this is, but try something like this:
Add a new property to your form called MyTabControl that returns an instance of the private TabControl. In the get property, set the webbrowser control's Visible = true. Then in code, replace all of YOUR lines from tabControl1 to MyTabControl. By "your" lines I mean don't change the "windows designer generated code" - mostly everything in the InitializeComponent function.

Untested, but something like this should work.

-Nerseus
 
Right on!

Brilliant idea! and so far so good, Thanx to you Nerseus :D


I used this code:
Visual Basic:
  Private MyTabPageData As TabPage
  Private Property MyTabPage() As TabPage
    Get
      Return MyTabPageData
      Me.AxWebBrowser1.Visible = True
    End Get
    Set(ByVal Value As TabPage)
      MyTabPageData = Value
      Me.AxWebBrowser1.Visible = True
    End Set
  End Property

  Private Sub Form1_Load(Blahhhh) Handles MyBase.Load

    Me.MyTabPage = New TabPage()
    Me.TabControl1.TabPages.Add(Me.MyTabPage)

  End Sub

It seems to be working now ==)

I'm going to test it a little more and post my results...

Thanx again!!!
 
Back
Top