| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 
 | protected void nbheureTextBox_TextChanged(object sender, EventArgs e)
        {
            Debug.WriteLine( "TextBox1_TextChanged ######" );
            this.RemoveTextBox( m_kIColTxBx );
 
            try
            {
                int iNbtxtBx;
                if ( Int32.TryParse( ( (TextBox)( sender ) ).Text, out iNbtxtBx ) )
                {
                    m_kIColTxBx.Clear();
                    for ( int i = 0; i < iNbtxtBx; ++i )
                    {
                        TextBox kTxBx = new TextBox();
                        kTxBx.ID = "TextBox_" + i.ToString();
                        kTxBx.Text = "Heure n° " + i.ToString();
                        kTxBx.Height = 30;
                        kTxBx.Width = 500;
                        kTxBx.Visible = true;
                        kTxBx.Enabled = true;
                        kTxBx.AutoPostBack = true;
 
                        m_kIColTxBx.Add( kTxBx );
 
                    }
                    AddTextBox( m_kIColTxBx );
                }
 
            }
            catch ( Exception exc )
            {
                Debug.WriteLine( "ERROR : " + exc );
            }
        }
 
        protected void TextBoxPhrase_TextChanged(object sender, EventArgs e)
        {
            Debug.WriteLine(" ###### TextBoxPhrase_TextChanged");
 
            this.RemoveTextBox(m_kIColTxBx);
            TextBox kTxBx = ((TextBox)(sender));
            int iStart = m_kIColTxBx.IndexOf(kTxBx);
            for (int i = iStart; i < m_kIColTxBx.Count; ++i)
            {
                m_kIColTxBx[i].Text = kTxBx.Text;
            }
            AddTextBox(m_kIColTxBx);
        }
 
        protected void AddTextBox(IList<TextBox> TextBoxList)
        {
            IEnumerator kEnumerator = TextBoxList.GetEnumerator();
            TextBox kTxBx;
            while (kEnumerator.MoveNext())
            {
                kTxBx = ((TextBox)(kEnumerator.Current));
                kTxBx.TextChanged += new EventHandler(this.TextBoxPhrase_TextChanged);
                this.form1.Controls.Add(kTxBx);
            }
        }
 
        protected void RemoveTextBox(IList<TextBox> TextBoxList)
        {
            IEnumerator kEnumerator = TextBoxList.GetEnumerator();
            while (kEnumerator.MoveNext())
            {
                this.form1.Controls.Remove(((TextBox)(kEnumerator.Current)));
            }
        } | 
Partager