These are chat archives for chat-rooms/programming

14th
Jan 2017
FarhadMohseni
@FarhadMohseni
Jan 14 2017 22:06
Hi There
I have question From C# Programming , AnyOne Can Help me?
I Writed This Function :
 private void LoadColors()
    {
        string Line;
        string Line2 = null;
        string[] Lines;
        string[] Lines2;
        bool Found = false;
        string Line1;
        StreamReader reader = null;
        StreamReader reader2 = null;
        //Diynamically Make Controls
        Panel panel = new Panel();
        Label label = new Label();
        TextBox textbox = new TextBox();
        Button button = new Button();
        panel.Size = new Size(398, 35);
        label.Size = new Size(157, 13);
        textbox.Size = new Size(83, 20);
        button.Size = new Size(75, 23);
        button.BackColor = Color.FromName("ButtonFace");
        button.Text = "Select";
        panel.Controls.Add(label);
        label.Location = new Point(3, 12);
        panel.Controls.Add(textbox);
        textbox.Location = new Point(231, 8);
        panel.Controls.Add(button);
        button.Location = new Point(320, 6);
        //ReadFile

            reader = new StreamReader("colors.tdesktop-theme");

            Line = reader.ReadLine();
            while (Line != null)
            {
               if (!Line.StartsWith("//") |Line != "") 
                {
                    Lines = Line.Split(':');
            //    MessageBox.Show(Lines[0]+Lines[1]);
             Lines[1]=   Lines[1].Replace(" ", "");
                Lines[1]=Lines[1].Replace(";","");
              //  MessageBox.Show(Lines[0] + Lines[1]);
                if (Lines.Length > 1)
                    {
                        label.Text = Lines[0];
                    }
               string Line12 = Lines[1];
                        if (Line12.StartsWith("#"))
                        {
                            textbox.Text = Lines[1].ToString();
                        }
                        else
                        {
                            reader2 = new StreamReader("colors.tdesktop-theme");


                            while (Found)
                            {
                                Line2 = reader2.ReadLine();
                                if (Line2.StartsWith(Lines[1]))
                                {
                                    Lines2 = Line2.Split(':');
                                    textbox.Text = Lines2[1];
                                }
                                Found = true;
                            }

                        }
                        textbox.BackColor = ColorTranslator.FromHtml(textbox.Text);
but When I Run The ProgRAMM , that codes going to endless loop and my form Not showed
whats the problem? sry for my bad english :(