Saving

  • Thread starter Thread starter pregis
  • Start date Start date
P

pregis

Is there a way that I can save text in a textbox to the code I've written so
that the next time I open the application the text is what I saved it to last
time?

Can you please guide me in the right direction?

Thank you!


Patrick
 
I don't think that you would want to save it "to the code", but you could
easily save it to a file. OR ... the framework will do this for you. Do a
search in Help for "settings". I think that it requires Framework 2.0 or
later.

Bob
 
I don't think that you would want to save it "to the code", but you could
easily save it to a file. OR ... the framework will do this for you. Do a
search in Help for "settings". I think that it requires Framework 2.0 or
later.

Bob
 
pregis said:
Is there a way that I can save text in a textbox to the code I've written
so
that the next time I open the application the text is what I saved it to
last
time?

Can you please guide me in the right direction?

Thank you!


Patrick
Have a look at "My Project"/Settings and create an entry called
"TextBoxData" User-Text. In your form "Form Closing" event put the following
code:

My.Settings.TextBoxData = MyTextBox.Text
My.Settings.Save()

When you next time load the form do something like:

Private Sub Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MyTextBox.Text = My.Settings.TextBoxData

End Sub

Hope I got your question right.
 
pregis said:
Is there a way that I can save text in a textbox to the code I've written
so
that the next time I open the application the text is what I saved it to
last
time?

Can you please guide me in the right direction?

Thank you!


Patrick
Have a look at "My Project"/Settings and create an entry called
"TextBoxData" User-Text. In your form "Form Closing" event put the following
code:

My.Settings.TextBoxData = MyTextBox.Text
My.Settings.Save()

When you next time load the form do something like:

Private Sub Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MyTextBox.Text = My.Settings.TextBoxData

End Sub

Hope I got your question right.
 
This is perfect. Thank you.

Harry Strybos said:
Have a look at "My Project"/Settings and create an entry called
"TextBoxData" User-Text. In your form "Form Closing" event put the following
code:

My.Settings.TextBoxData = MyTextBox.Text
My.Settings.Save()

When you next time load the form do something like:

Private Sub Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MyTextBox.Text = My.Settings.TextBoxData

End Sub

Hope I got your question right.
 
This is perfect. Thank you.

Harry Strybos said:
Have a look at "My Project"/Settings and create an entry called
"TextBoxData" User-Text. In your form "Form Closing" event put the following
code:

My.Settings.TextBoxData = MyTextBox.Text
My.Settings.Save()

When you next time load the form do something like:

Private Sub Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MyTextBox.Text = My.Settings.TextBoxData

End Sub

Hope I got your question right.
 
I'm not arguing with you because I am sure not an expert. But to just save
whatever a user typed into a Textbox you don't need to write a line of code.
All you have to do is to use the "(Application Settings)" Property in the
Designer. (At least for .NET 3.5.)

Bob
 
I'm not arguing with you because I am sure not an expert. But to just save
whatever a user typed into a Textbox you don't need to write a line of code.
All you have to do is to use the "(Application Settings)" Property in the
Designer. (At least for .NET 3.5.)

Bob
 
eBob.com said:
I'm not arguing with you because I am sure not an expert. But to just
save whatever a user typed into a Textbox you don't need to write a line
of code. All you have to do is to use the "(Application Settings)"
Property in the Designer. (At least for .NET 3.5.)

Bob

Thanks for that. While what you save still puts an entry Settings, it does
save some code. Well done. Something new I learned.
 
eBob.com said:
I'm not arguing with you because I am sure not an expert. But to just
save whatever a user typed into a Textbox you don't need to write a line
of code. All you have to do is to use the "(Application Settings)"
Property in the Designer. (At least for .NET 3.5.)

Bob

Thanks for that. While what you save still puts an entry Settings, it does
save some code. Well done. Something new I learned.
 
Back
Top