|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
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 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 "pregis" <pre***@discussions.microsoft.com> wrote in message Have a look at "My Project"/Settings and create an entry called 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 "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.
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. > > > > > 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. > > > > "eBob.com" <faken***@totallybogus.com> wrote in message Thanks for that. While what you save still puts an entry Settings, it does 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 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. >> >> >> >> > >
Application development pointers
problem with RaiseEvents detect file status Internal Server Error 500 Resizing the click area of a checkbox. Search for values in between two values in a string? Vb and Active Directory Visual Basic 4.0 16/32 Capture Routines for .Net? bold selected text Export a Graphic to Excel Spreadsheets |
|||||||||||||||||||||||