Below is my NLog configuration, I want to load log into existing RichTextBox called rtMessage in Form1, but NLog will create a new windows with log message loaded into the R
1.normally init logger in winform1_Load
while it have done InitializeComponent
-> has init your own RichTextBox.
2.then makesure your RichTextBoxTarget
's FormName
and ControlName
initialized ok.
such as:
RichTextBoxTarget rtbTarget = new RichTextBoxTarget();
logConfig.AddTarget("richTextBox", rtbTarget);
rtbTarget.FormName = "frmScrapeAmazonProduct"; // your winform class name
rtbTarget.ControlName = "rtbLog"; // your RichTextBox control/variable name
more can refer my post