Okay so this has been bugging me for quite sometime. I thought if I skipped it and came back maybe I might figure it out but I guess not. The basic idea is to let the user generate their own content into a list box, text box, and the content still be there the next time the user opens the program. Like, say I want to make an archive. I give the user an option to create a name for whatever they are storing and store that to a list box, then store whatever they put into the rich text box gets stored for call by the name in the list box. For example with quite incorrect pseudo code:

void buttonSubmit()
{
this.listBox1.Items.AddRange(new object[] {nameTextBox.Text});

if (mainTextBox.Text = "")
{
MessageBox.Show("Please put something into the text box for us to store with the name you gave.");
}

else
{
storageBox.Text = mainTextBox.Text;
}
}

void listBoxCalls() // This is the selected index event for example.
{
if (listeBox.SelectedIndex = 0)
{
nameLabel.Text = listBox.IndexName; // I know this is not proper but it's pseudo :D
mainTextBox.Text = storageBox.Text;
}
}

Something of that nature. I have no idea how I would really do this, so can someone help me please?

I don't really get what you are trying to do.

To use Settings first right-click on your project, select Settings and add the required settings. Let's say you have added a string "storageBoxTxt" to the settings then this is how you'll use it:

if (mainTextBox.Text = "")
{
      MessageBox.Show("Please put something into the text box for us to store with the name you gave.");
}
else
{
     storageBox.Text = mainTextBox.Text;
     YourNameSpace.Properties.Settings.[B]storageBoxTxt[/B] = mainTextBox.Text;

     // Don't forget to save the settings.
     YourNameSpace.Properties.Settings.Save();
}

To retrieve the settings when the app is opened assign the values from the Settings in Form_Load or public Form1():

private void Form1_Load(object sender, EventArgs e)
{
     storageBox.Text = YourNameSpace.Properties.Settings.[B]storageBoxTx[/B]t;
}

Also, check this link:
http://www.codeproject.com/KB/cs/PropertiesSettings.aspx

Thanks

I think that might do it, I will let you guys know soon enough. I have a quick problem to solve with my if statements for a graphical part of the app. Much thanks for the help and I will reply in a little bit to say if it worked. :D

Only one problem with it so far... I seem to be missing a reference and can't figure out where it is or how to include it...

An object reference is required for the non-static field, method, or property 'userStore.Properties.Settings.storage.get'

That's the error I get at compiling. There are two others just like it but for the other two lines that say the same thing. Please help.

void button2_Click(object sender, EventArgs e)
        {
             storage.Text = userStore.Properties.Settings.storage;

             if (display.Text == "")
             {
                  MessageBox.Show("Please put something into the text box for us to store with the name you gave.");
             }
             else
             {
                 storage.Text = display.Text;
                 userStore.Properties.Settings.storage = display.Text;
                 userStore.Properties.Settings.Save();
             }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.