How can I show/hide a RichTextBox target with NLog? [duplicate]
I'm having two little problems that I need help with...
1) If I'm using a RichTextBox target without a form name (ie. it's creating it's own form), how can I show/hide the form that it creates? (I'd like a shortcut key in my application to be able to show/hide the log window, etc)
2) If I specify a form name and control name fo开发者_如何学JAVAr my RichTextBox target control, NLog still creates it's own window. It seems like it's doing this because my log form (frmLog) isn't created until somebody clicks "Show Log Window" (button) on my main form. How can I get around this?
Don't create the logger until the form is loaded.
Private Shared Logger As NLog.Logger = Nothing
Private Sub NewForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NOTE: had to create this after form had loaded, couldn't do it during static initialization
Logger = LogManager.GetCurrentClassLogger()
End Sub
精彩评论