Ok, this is a little hard to explain, i basically am making a miniature operating system and there is a notepad feature. I am allowing a save in this operating system. I have a hidden button on the mainscreen than shows itself when the save is clicked on the notepad form. The problem is that I cannot figure out how to actually make it save. I need this button to be clicked, the notepad form to open (not a problem,) and the multiline textbox to have the same text as before. Any help would be appreciated. Thanks a lot

You lost me on your sequence of events. However, the simplest way to store the textbox is to use "UserSettings". Go to Project->Properties and select the Settings tab. Create three setting like these:


Then in your notepad form do something like this:

   Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
      My.Settings.SavedTBText = TextBox1.Text
      My.Settings.SavedTBSelectionStart = TextBox1.SelectionStart
      My.Settings.SavedTBSelectionLength = TextBox1.SelectionLength
   End Sub

   Private Sub Form_NotePad_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      With TextBox1
         .Text = My.Settings.SavedTBText
         .SelectionStart = My.Settings.SavedTBSelectionStart
         .SelectionLength = My.Settings.SavedTBSelectionLength
      End With
   End Sub

This will save/restore the state of the textbox on the notepad form.

Edited 4 Years Ago by TnTinMN: typo

Sorry to confuse you but this was all that I was looking for. I really appreciate it

This question has already been answered. Start a new discussion instead.