Napisałem na zaliczenie w asp.net konwersje z dec na bin, hex, oct i na odwrót. Są 4 pola TextBox.
Ale nie wiem jak to połączyć aby działało w drugą stronę.
Napisałem tak:

 
protected void Button1_Click(object sender, EventArgs e)
        {
            if ((TextBox1.Text =="0") && (TextBox2.Text =="0") && (TextBox3.Text =="0") && (TextBox4.Text =="0"))
            {
                Label6.Text = "Wykonaj konwersję!";
                TextBox1.Enabled = false;
                TextBox2.Enabled = false;
                TextBox3.Enabled = false;
                TextBox4.Enabled = false;
            }
           //#################  Blok konwersji w jedną stronę ######################
            

            int bin, hex, oct;
            if (TextBox1.Text == "")
            {
                TextBox4.Text = "0";
                TextBox3.Text = "0";
                TextBox2.Text = "0";
                TextBox1.Text = "0";


            }
            else
            {
                bin = int.Parse(TextBox1.Text);
                TextBox4.Text = Convert.ToString(bin, 2);
                hex = int.Parse(TextBox1.Text);
                TextBox2.Text = Convert.ToString(hex, 16);
                oct = int.Parse(TextBox1.Text);
                TextBox3.Text = Convert.ToString(oct, 8);

            }

             //z bin na inne systemy
            string binhex, bindec, binoct;
            
            if (TextBox4.Text == "")
            {
                TextBox4.Text = "0";
                TextBox3.Text = "0";
                TextBox2.Text = "0";
                TextBox1.Text = "0";

            }
            else
            {
                bindec = string.Copy(TextBox4.Text);
                TextBox1.Text = Convert.ToInt32(bindec, 2).ToString();
                binhex = string.Copy(TextBox4.Text);
                TextBox2.Text = Convert.ToString(Convert.ToInt32(TextBox4.Text, 2), 16);
                binoct = string.Copy(TextBox4.Text);
                TextBox3.Text = Convert.ToString(Convert.ToInt32(TextBox4.Text, 2), 8);
            }

            // z octal na inne systemy
            string octdec, octhex, octbin;

            if (TextBox3.Text == "")
            {
                
                TextBox3.Text = "0";
                TextBox4.Text = "0";
                TextBox2.Text = "0";
                TextBox1.Text = "0";

            }
            else
            {
                octdec = string.Copy(TextBox3.Text);
                TextBox1.Text = System.Convert.ToString(Convert.ToInt32(TextBox3.Text, 8), 10);
                octhex = string.Copy(TextBox3.Text);
                TextBox2.Text = System.Convert.ToString(Convert.ToInt32(TextBox3.Text, 8), 16);
                octbin = string.Copy(TextBox3.Text);
                TextBox4.Text = System.Convert.ToString(Convert.ToInt32(TextBox3.Text, 8), 2);
            }

            // z hex na inne systemy
            string hexdec, hexoct, hexbin;

            if (TextBox2.Text == "")
            {
                TextBox2.Text = "0";
                TextBox3.Text = "0";
                TextBox4.Text = "0";
                TextBox1.Text = "0";

            }
            else
            {
                hexdec = string.Copy(TextBox2.Text);
                TextBox1.Text = System.Convert.ToString(Convert.ToInt32(TextBox2.Text, 16), 10);
                hexoct = string.Copy(TextBox2.Text);
                TextBox3.Text = System.Convert.ToString(Convert.ToInt32(TextBox2.Text, 16), 8);
                hexbin = string.Copy(TextBox2.Text);
                TextBox4.Text = System.Convert.ToString(Convert.ToInt32(TextBox2.Text, 16), 2);
            }


          
        }

Próbowałem z case ale nie wychodziło. Na koniec muszę dodać aby po każdej konwersji były nie aktywne pola i przycisk button ale to wiem jak zrobić. Nie wiem jak połączyć.