Results 1 to 2 of 2

Thread: Keep the form inputs after hiding

  1. #1

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Keep the form inputs after hiding

    Hi,

    I'm using the following code to show and hide a form...

    I'm showing form2 by clicking a button in form1 and again showing the form1 by clicking a buttin in form2...

    I'm not closing ant of the form..i just hide it...
    but i couldn't keep the inputs of Form2...don't know why????





    VB Code:
    1. In form1 button click
    2. --------------------------
    3.  
    4. Dim nf As New form2
    5. nf.MyForm = Me
    6. nf.Show()
    7. Me.Hide()
    8.  
    9.  
    10. In form2 General Declaration
    11. -------------------------------------
    12.  
    13. Private pf As form1
    14.  
    15.     Public Property MyForm() As form1
    16.         Get
    17.             Return pf
    18.         End Get
    19.         Set(ByVal Value As form1)
    20.             pf = Value
    21.         End Set
    22.  
    23.     End Property
    24.  
    25. In form2 button click event
    26. ---------------------------------
    27.  If pf Is Nothing Then
    28.                     Dim pf As New form1
    29.                     pf.Show()
    30.                     Me.Hide()
    31.  
    32.                 Else
    33.                     pf.Show()
    34.                    Me.Hide()
    35.  
    36.                 End If


    I'm very thankful if anybody helps me......

  2. #2
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    Uhmmmm....I think you re-instance Form2, if you use:

    Dim nf As New form2
    nf.MyForm = Me
    nf.Show()
    Me.Hide()

    Your first line of code creates a new (empty) instance of Form2, isn't it?


    Obviously, this is true if you use always this way to recall (re create, in this case) your form.
    Live long and prosper (Mr. Spock)

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