astrid22 astrid22 -3 years ago 67
Vb.net Question

how to make textboxes retain data

Okay, so I am trying to make a form with 3 textboxes and next and back buttons. I am supposed to enter data in those textboxes. What I want to do is if I click on the next button, that same form will show its initial state (3 empty textboxes and two button) but if I click on the back button, it will show the data I entered in the textboxes where I entered them. Basically, I want the textboxes be able to retain data. I have absolutely no idea how to do this. I have searched around the net to no avail. Does this require a database or something? Please help :(

Answer Source

You could always just create a tag for each textbox containing the text that was in that textbox before you clear the textbox.

Textbox1.Tag = Textbox1.Text
Textbox1.Clear()

And then to recall with your back button:

Textbox1.Text = Cstr(Textbox1.Tag)

And once you are done with the data:

Textbox1.Tag = Nothing
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download