Button not visible in TabPage

G

grompl

..NET CF 1.0 SP3, PocketPC 4.20.0.14053, Device: Intermec CN2B

I have a panel with a tab control with two tab pages and a button named
'ok'. If the selected tab page changes I'm adding that button to the
selected tab page:

Private Sub tabControl_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles tabControl.SelectedIndexChanged

Me.tabControl.TabPages(Me.tabControl.SelectedIndex).Controls.Add(Me.ok)
End Sub

I think this code should automatically remove the button from the
deselected tab and add it to the selected tab.
My problem is that the button is not visible after changing the tab
page. but if I click at the position where the button should be, the
button is clicked. In my application the button is located at the
bottom left corner of the panel. so, the position of the button is
covered by the menu, if I open it. after opening and closing the menu
the button is suddenly visible. so I thought that the problem is that
the button was not repainted. but adding Refresh() and Invalidate()
methods of the panel, tabcontrol, tabpage, button does not solve the
problem.
Any suggestions?
 
G

grompl

maybe someone can just create a small test app in visual studio with
two tabpages and a button on one page. and then please try to add code
that switches the parent control of the button to the selected tab
pages, if the selected tab page changes. if you just add the button to
the other page, you will see that the button is not visible. and if you
have a solution, please post it.
 

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