Jump to content
Son zamanlarda artan kullanıcı hesap hırsızlıkları sebebiyle tüm kullanıcılara şifre sıfırlama maili gönderilmiştir. Lütfen güveli şifreler seçiniz. Mevcut e-mail adresinize erişemiyorsanız, en aşağıdaki destek linkinden bize ulaşınız. ×

Textbox Multiline Için Satır/karakter Limiti Eski Satırları Temizleme


canavar123
 Share

Recommended Posts

Youtube-dl kullanarak Youtube'dan indirme yapan bir program yazdım ama TextBox'a çok fazla satır eklendiği için uygulama bir süre sonra yavaşlıyor ve yavaşladıkça daha da çok satır ekleniyor. Bu da işlemleri çok uzatıyor. Ben 500 satırı geçtiğimde en üstteki satırdan başlayarak silinmesini istiyorum. Bunu nasıl yaparım? İngilizce olarak arattım ama doğru düzgün bir cevaba rastlayabilmiş değilim. MaxLenght ile ilgili tartışmalara denk geldim ama o değer 32.000 civarındayken benim TextBox'ta şu an 888.000 karakter bulunuyor.

Link to comment
Share on other sites

  • 1 ay sonra...

Textbox ile sorun olur . RichTextBox kullan 50000 satırda olsa sorun olmaz.

 

  public void TestKayitEkle()
        {
            for (int i = 0; i < 5000; i++) // 5000 satir test kaydi ekle
            {
                richTextBox1.AppendText("www." + i.ToString() + ".com\n");
                Application.DoEvents();// arayuzu kilitleme
                if (richTextBox1.Lines.Count() > 500) // kayitsayisi 500 den fazla ise ilk satiri temizle
                {
                    SatirSil();

                }
            }
        }

        public void SatirSil()
        {
            List<string> myList = richTextBox1.Lines.ToList();
            if (myList.Count > 0)
            {
                myList.RemoveAt(0); // ilk indeksi temizle
                richTextBox1.Lines = myList.ToArray();
                richTextBox1.Refresh();
                Application.DoEvents();// arayuzu kilitleme
            }
        }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...