Home All Groups Group Topic Archive Search About
Author
13 May 2009 11:38 PM
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

Author
14 May 2009 12:03 AM
eBob.com
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

Show quoteHide quote
"pregis" <pre***@discussions.microsoft.com> wrote in message
news:B5EDDF69-FB13-49F2-835A-995920508CCB@microsoft.com...
> 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
Author
14 May 2009 5:38 AM
Harry Strybos
"pregis" <pre***@discussions.microsoft.com> wrote in message
news:B5EDDF69-FB13-49F2-835A-995920508CCB@microsoft.com...
> 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.
Author
14 May 2009 4:42 PM
pregis
This is perfect.  Thank you.

Show quoteHide quote
"Harry Strybos" wrote:

> "pregis" <pre***@discussions.microsoft.com> wrote in message
> news:B5EDDF69-FB13-49F2-835A-995920508CCB@microsoft.com...
> > 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.
>
>
>
>
>
Author
14 May 2009 6:16 PM
eBob.com
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

Show quoteHide quote
"Harry Strybos" <harrystry***@optusnet.com.au> wrote in message
news:eRHd5XF1JHA.4468@TK2MSFTNGP05.phx.gbl...
> "pregis" <pre***@discussions.microsoft.com> wrote in message
> news:B5EDDF69-FB13-49F2-835A-995920508CCB@microsoft.com...
>> 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.
>
>
>
>
Author
14 May 2009 8:39 PM
Harry
"eBob.com" <faken***@totallybogus.com> wrote in message
news:eUwQpAM1JHA.5440@TK2MSFTNGP02.phx.gbl...
> 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.

Show quoteHide quote
>
> "Harry Strybos" <harrystry***@optusnet.com.au> wrote in message
> news:eRHd5XF1JHA.4468@TK2MSFTNGP05.phx.gbl...
>> "pregis" <pre***@discussions.microsoft.com> wrote in message
>> news:B5EDDF69-FB13-49F2-835A-995920508CCB@microsoft.com...
>>> 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.
>>
>>
>>
>>
>
>