简体   繁体   中英

c# richtextbox only shows one line

been searching the internet for some time now and cant find a solution to my problem.

I'm trying to parse some lines into the richtextbox, but i only get one line instead of all of them. Heres a part of my code

        foreach (var val in lineCountDict)
        {
            richTextBox2.Text = (val.Key + " - " + val.Value + " Drops -" +
            ((double)val.Value / (double)mobDeathCounter) * 100 + " % chance\n");


        }

So when i run this i only get one line, any advice would be awesome

Thank you!

Of course you get one line since in each iteration you set richTextBox2.Text to the new value which replaces the old value.

Use richTextBox2.Text+="..."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM