canavar123 Posted December 15, 2020 Share Posted December 15, 2020 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. Quote Link to comment Share on other sites More sharing options...
bilaltr2 Posted January 16, 2021 Share Posted January 16, 2021 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 } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.