private void Form1_Load(object sender, EventArgs e)
        {
            string[] after;
            RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Battle.net\Configuration");
            after = (string[])key.GetValue("Battle.net gateways");
            
            foreach (string str in after)
            {
                    textBox1.Text += str + Environment.NewLine;
            }
            key.Close();
         }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            string[] before = textBox1.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Battle.net\Configuration");
            key.SetValue("Battle.net gateways", before);
        }