Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[FIXED] prevent richtextbox from displaying the same string after the second time run

I tried to display the string into the richtextbox, but always got the same or duplicate string after the second time it was run as in example of displaying a second string.

Example of displaying the first string:
Quote:[21:55:07] - [-] Starting scanning, please wait. . .

[21:55:09] - [-] Finished.



Example of displaying a second string:
Quote:[21:55:07] - [-] Starting scanning, please wait. . .

[21:55:09] - [-] Finished.

[21:55:07] - [-] Starting scanning, please wait. . .

[21:55:09] - [-] Finished.


code :
Spoiler (Click to View)

I have tried adding
Code
if (DisplayTextBox.Text ! = null)
   {
      DisplayTextBox.Clear();
    }
but still there is no change, the second time the scan button is run it will bring up the same two strings.

How do I prevent it from displaying duplicate strings like in the example second string?
I want to display strings like in the example of the first string display.



[FIXED]
I try to use Application.Restart(); to restart Form into its original state as well to prevent displaying the same string again.
And log all the strings to text file using Streamwriter
are you using check for cross-thread before calling the backgroundworker? ??
because you can't use the richtextbox without invoking it to UI thread.

if you don't want to invoke it, then add "CheckForIllegalCrossThreadCalls = false;" inside your Form1_Load.
(Jun 22, 2019 07:06 AM)NYANxCAT Wrote:  are you using check for cross-thread before calling the backgroundworker? ??
because you can't use the richtextbox without invoking it to UI thread.

if you don't want to invoke it, then add "CheckForIllegalCrossThreadCalls = false;"  inside your Form1_Load.

Unless very specific circumstances are applicable (great emphasis on the word "very" here), nobody should ever use the CheckForIllegalCrossThreadCalls property, ever.
https://github.com/Washi1337

"I'll tell you this UDP joke, and I don't care if you will get it or not."
(Jun 22, 2019 09:47 AM)Washi Wrote:  Unless very specific circumstances are applicable (great emphasis on the word "very" here), nobody should ever use the CheckForIllegalCrossThreadCalls property, ever.

I agree with you.
(Jun 22, 2019 07:06 AM)NYANxCAT Wrote:  are you using check for cross-thread before calling the backgroundworker? ??
because you can't use the richtextbox without invoking it to UI thread.

if you don't want to invoke it, then add "CheckForIllegalCrossThreadCalls = false;"  inside your Form1_Load.

I don't use it, thank you for the information and I will try to fix it again 😉


Possibly Related Threads...
Thread / Author Replies Views Last Post
[The Brotherhood] by HackersApr 10, 2026 02:15 AM 22 2,160 Apr 10, 2026 02:15 AM
Last Post: PELock
by KlonopinApr 10, 2026 02:08 AM 10 648 Apr 10, 2026 02:08 AM
Last Post: PELock
[Python] by MaskinMay 25, 2022 05:29 PM 4 374 May 25, 2022 05:29 PM
Last Post: Maskin