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..
Printable View
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..
Save it to a public variable then pull it back in when you return.
Or just Hide the form rather than Unloading it.
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!
What are you using to show it again, something like Form1.Show?
yes Yes!
When you show the form again it should have the values in the textboxes unless there is something in the form's Activate event that deletes it.
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:
Private Sub Command1_Click() Me.Hide Form2.Show End Sub
and this for form2:
VB Code:
Private Sub Command1_Click() Me.Hide Form1.Show 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.
i think i got it cuz i have create a NEW form each time i click the next button....tanks to you all!
Edit your original Subject and add [Resolved], that will tell people that the subject has been resolved and you no longer require help.