Results 1 to 10 of 10

Thread: Retain the values back..

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908

    Retain the values back..

    How do I retain the values in the textboxes for eg. when I click the a Back button to show the previous form? cuz when i do it now the values are all empty..

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Save it to a public variable then pull it back in when you return.

  3. #3

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    i have been using me.hide when i show the next form..from the previous form but cant see the vaules when back..

    and wat do you mean by Save it to a public variable then pull it back in when you return..can you pls elborate thanks!

  5. #5
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    What are you using to show it again, something like Form1.Show?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    yes Yes!

  7. #7

  8. #8
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    You must be doing something in your code that clears the value, i just wrote a quick 2 form routine that has this for form1:

    VB Code:
    1. Private Sub Command1_Click()
    2. Me.Hide
    3.  
    4. Form2.Show
    5. End Sub

    and this for form2:

    VB Code:
    1. Private Sub Command1_Click()
    2. Me.Hide
    3. Form1.Show
    4. End Sub

    And both Text boxes on the forms retain both their values when I press the command buttons.

    If you can't find where the text is being replaced, then you can copy the contents before you go to your other form and then read it back in when you come back. In a Module, delcare a public variable like

    Pubic strValue as String

    Then in your first form, write the contents before you do a me.hide, like strValue = text1.text. Then when you hit the back button on your second form, do a form1.text1.text = strValue after the form1.show command and before the me.hide command for form 2.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    i think i got it cuz i have create a NEW form each time i click the next button....tanks to you all!

  10. #10
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Edit your original Subject and add [Resolved], that will tell people that the subject has been resolved and you no longer require help.

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