bigboy123 Posted November 1, 2009 at 03:37 AM Report Share #294225 Posted November 1, 2009 at 03:37 AM Boas a todos, Tenho aqui um pequeno problema que gostaria de resolver com a vossa ajuda, é o seguinte : Eu inseri no meu Form um TabControl com 4 TabPages. Eu preciso que ao clicar na aba de uma TabPage apareça por exemplo " MsgBox("Teste") " , mas o problema é que com o evento Click da TabPage so aparece a mensgem se eu clicar na página do TabPage e não na aba ! Alguém sabe como posso resolver isto ? 😉 Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 1, 2009 at 12:14 PM Report Share #294241 Posted November 1, 2009 at 12:14 PM Lembra-te que estás a trabalhar eventos da TabControl e não da TabPage. O Click refere-se portanto ao TabControl. O que tens de verificar é se o índice de selecção da TabControl alterou e quando alterar significa que alguém carregou num tab diferente do actual. Depois basta trabalhares com o "SelectedTab" que representa uma instância da classe TabPage, neste caso a que foi seleccionada. Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged MsgBox("Sou a tab com o texto:" & TabControl1.SelectedTab.Text) End Sub Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
bigboy123 Posted November 1, 2009 at 09:32 PM Author Report Share #294326 Posted November 1, 2009 at 09:32 PM Muito obrigado ribeiro55, resolveu perfeitamente a minha dúvida 😁 5* Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now