Results 1 to 2 of 2

Thread: close mdi child

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    10

    close mdi child

    Hi!
    I have a container,in this container i have a button,when i click in the button a new form is open(mdichild).What i have to do to every time i click the button,when a new form is open the other is closed?


    The code:
    sub button_click()
    If (tipo = 1) Then
    Dim tipoTexto As New Texto()
    tipoTexto.MdiParent = Me
    tipoTexto.Show()
    end if

    If (tipo = 2) Then
    Dim tipoImagem As New Imagem()
    tipoImagem.MdiParent = Me
    tipoImagem.Show()
    end if

    end sub

    When the form "tipoImagem" open i want that the form "TipoTexto" is closed.

    tanks!

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    maybe something like this...
    VB Code:
    1. Sub button_Click()
    2. If tipo = 1 Then
    3.     Dim tipoTexto As New Texto()
    4.     tipoTexto.MdiParent = Me
    5.     tipoTexto.Show()
    6. ElseIf tipo = 2 Then
    7.     Dim tipoImagem As New Imagem()
    8.     tipoImagem.MdiParent = Me
    9.     tipoImagem.Show()
    10.     If Not tipoTexto Is Nothing Then '/// make sure tipoTexto isn't Nothing.
    11.         tipoTexto.Close()
    12.     End If
    13. End If
    14.  
    15. End Sub
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width