How do I use the save feature on tabcontols?
<p>I have a form where I can add tabs into a tabcontrol by pressing a button on the form.  There are 4 textboxes and then the name of the tab.  I have added using system.io;  </p>

<p>Where would I even start to create a save for all of the tabs?  I have the save button created, I just don't know where to start.  I would guess I would need a loop of some kind.</p>

<pre><code>namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public string status = "no";

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string name = txtName.Text;


            //validate information
            try { }
            catch { }

            //create new tab
            string title = name;
            TabPage myTabPage = new TabPage(title);
            tabControl1.TabPages.Add(myTabPage);


            //Add Labels

            Label lb = new Label();
            lb.Text = "Denomination:";
            lb.Location = new System.Drawing.Point(150, 75);
            lb.Name = "lbl";
            lb.Size = new System.Drawing.Size(100, 20);
            myTabPage.Controls.Add(lb);

            Label lb2 = new Label();
            lb2.Text = "Year:";
            lb2.Location = new System.Drawing.Point(150, 120);
            lb2.Name = "lbl2";
            lb2.Size = new System.Drawing.Size(100, 20);
            myTabPage.Controls.Add(lb2);

            Label lb3 = new Label();
            lb3.Text = "Grade:";
            lb3.Location = new System.Drawing.Point(150, 165);
            lb3.Name = "lbl3";
            lb3.Size = new System.Drawing.Size(100, 20);
            myTabPage.Controls.Add(lb3);

            Label lb4 = new Label();
            lb4.Text = "Mint Mark:";
            lb4.Location = new System.Drawing.Point(150, 210);
            lb4.Name = "lbl4";
            lb4.Size = new System.Drawing.Size(100, 20);
            myTabPage.Controls.Add(lb4);

            //Add text boxes

            TextBox tb = new TextBox();
            tb.Location = new System.Drawing.Point(250, 75);
            tb.Name = "txt";
            tb.Size = new System.Drawing.Size(184, 20);
            myTabPage.Controls.Add(tb);

            TextBox tb1 = new TextBox();
            tb1.Location = new System.Drawing.Point(250, 120);
            tb1.Name = "txt1";
            tb1.Size = new System.Drawing.Size(184, 20);
            myTabPage.Controls.Add(tb1);

            TextBox tb2 = new TextBox();
            tb2.Location = new System.Drawing.Point(250, 165);
            tb2.Name = "txt2";
            tb2.Size = new System.Drawing.Size(184, 20);
            myTabPage.Controls.Add(tb2);

            TextBox tb3 = new TextBox();
            tb3.Location = new System.Drawing.Point(250, 210);
            tb3.Name = "txt3";
            tb3.Size = new System.Drawing.Size(184, 20);
            myTabPage.Controls.Add(tb3);

            //put data inside of textboxes

            tb.Text = txtCoin.Text;
            tb1.Text = txtYear.Text;
            tb2.Text = txtGrade.Text;
            tb3.Text = txtMint.Text;

            // Add delete button

            Button bn = new Button();
            bn.Location = new System.Drawing.Point(560, 350);
            bn.Name = "btnDelete";
            bn.Text = "Delete";
            bn.Size = new System.Drawing.Size(100, 50);
            bn.Click += MyClick;
            myTabPage.Controls.Add(bn);
        }

        private void MyClick(object sender, EventArgs e)
        {
            Form2 myform = new Form2();
            myform.ShowDialog();




            if (status == "yes")
            { tabControl1.TabPages.Remove(tabControl1.SelectedTab); }

            status = "no";

        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {

            int counter;
            int ccounter;
            string outLine;

            string pathFileName = Path.Combine(Application.StartupPath, "coins.dat");

            StreamWriter writeIt = new StreamWriter(pathFileName);

            for (counter = 0; ((tabControl1.TabCount) -1) != 0 ;)
            {

            }
            writeIt.Close();

        }
    }
}
</code></pre>
