yekxmerr Posted March 9, 2009 at 10:31 AM Report Share #249338 Posted March 9, 2009 at 10:31 AM Boas, estou com um pequeno problema. O meu programa tem um formulário inicial, e tem um menustrip que abre os restantes formulários. Hoje decidi adicionar um tab control ao menu inicial e queria que os outros formulários abrissem dentro de esse tabcontrol de uma forma idêntica aos separadores do firefox. Tenho o seguinte código no menustrip: Private Sub CriarNovoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As Dim frmUser As New Aluno frmUser.TopLevel = False frmUser.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.TabControl1.TabPages(0).Controls.Add(frmUser) frmUser.Show() End Sub Alguem tem uma solução para os restantes formularios ? Isto é, queria carregar num butão e apareçer uma nova tab com o formulario la dentro. Cumps Cumps Link to comment Share on other sites More sharing options...
Hellblazer Posted March 9, 2009 at 02:14 PM Report Share #249382 Posted March 9, 2009 at 02:14 PM Dim newTab As New System.Windows.Forms.TabPage("Tab X") Dim frmToAdd As New Form2 newTab.Controls.Add(frmToAdd) TabControl1.TabPages.Add(newTab) There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
yekxmerr Posted March 9, 2009 at 06:10 PM Author Report Share #249443 Posted March 9, 2009 at 06:10 PM Desde ja agradeço pelo codigo mas tive erro na seguinte linha: newTab.Controls.Add(frmToAdd) Erro: " O controlo de nível superior não pode ser adicionado a um controlo " Link to comment Share on other sites More sharing options...
yekxmerr Posted March 10, 2009 at 08:16 PM Author Report Share #249730 Posted March 10, 2009 at 08:16 PM Não consigo resolver este problema 😛 Link to comment Share on other sites More sharing options...
anolsi Posted March 10, 2009 at 08:37 PM Report Share #249735 Posted March 10, 2009 at 08:37 PM Que eu saiba não podes adicionar um formulário a uma tab, mas não tenho a certeza. "Nós somos o que fazemos repetidamente, a excelência não é um feito, e sim, um hábito."Não respondo a questões por PM que possam ser colocadas no fórum! Link to comment Share on other sites More sharing options...
Hellblazer Posted March 11, 2009 at 09:21 AM Report Share #249814 Posted March 11, 2009 at 09:21 AM Segundo o primeiro post dele dá 😛 There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
yekxmerr Posted March 11, 2009 at 09:27 AM Author Report Share #249815 Posted March 11, 2009 at 09:27 AM Sim eu consegui. Mas no código do Hellblazer, dá-me aquele erro 😛 , e no meu código tenho de me referir qual separador quero abrir :S é um bocado chato Link to comment Share on other sites More sharing options...
Hellblazer Posted March 11, 2009 at 03:32 PM Report Share #249874 Posted March 11, 2009 at 03:32 PM http://www.experts-exchange.com/Programming/Languages/.NET/Q_22010830.html There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
jpaulino Posted March 11, 2009 at 04:12 PM Report Share #249884 Posted March 11, 2009 at 04:12 PM http://www.experts-exchange.com/Programming/Languages/.NET/Q_22010830.html Não é visível a todos ... aqui fica o código do link: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As New Form1 frm.TopLevel = False frm.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow frm.Dock = DockStyle.Fill AddHandler frm.FormClosed, AddressOf frm_FormClosed Dim tp As New TabPage frm.Tag = tp tp.Controls.Add(frm) frm.Show() TabControl1.TabPages.Add(tp) End Sub Private Sub frm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) TabControl1.TabPages.Remove(sender.tag) End Sub Link to comment Share on other sites More sharing options...
yekxmerr Posted March 11, 2009 at 06:06 PM Author Report Share #249928 Posted March 11, 2009 at 06:06 PM Muito Obrigado 👍 Link to comment Share on other sites More sharing options...
Hellblazer Posted March 12, 2009 at 09:34 AM Report Share #250112 Posted March 12, 2009 at 09:34 AM jpaulino lol 👍 por acaso até tens, tens e que descer o site todo para baixo 🙂 e um truque que eu descobri sem querer lol xD There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
jpaulino Posted March 12, 2009 at 09:59 AM Report Share #250117 Posted March 12, 2009 at 09:59 AM jpaulino lol 👍 por acaso até tens, tens e que descer o site todo para baixo 🙂 e um truque que eu descobri sem querer lol xD Não sabia 🙂 Link to comment Share on other sites More sharing options...
yekxmerr Posted March 14, 2009 at 09:11 PM Author Report Share #250740 Posted March 14, 2009 at 09:11 PM Bem, não gostei do aspecto de carregar formularios para dentro de tabs, portanto decidi utilizar só as tabs. Desde ja agradeço a vossa ajuda 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