vb.net - 如何使用不同类中的共享函数登录到 RichTextBox
问题描述
在执行另一个类中定义的函数时,将日志显示到 RichTextBox 的最佳方法是什么?
至于现在我已经尝试过这样的事情:
Public Class NewClass
Public Shared Function test(ByRef rtb As RichTextBox)
rtb.AppendText("logging")
''' do something useful and time consuming
rtb.AppendText("logging")
''' do something useful and time consuming
rtb.AppendText("logging")
End Function
End Class
我使用NewClass.test(RichTextBox1)
例如执行此功能。
它正在工作,我立即得到日志输出。
但是我在“NewClass”中有很多函数,并且希望有一种中央方式来进行日志记录,并将日志写入我的 RichTextBox。
是否有这样做的最佳实践?
非常感谢共同点!
解决方案
推荐阅读
- express - TypeError:无法在“WebAssembly”上执行“编译”:响应 MIME 类型不正确。预期的“应用程序/wasm”
- python - 如何在 Python 中将两个 SVG 图像堆叠在一起?
- django - 将postgresql数据库中的数据检索到django中的字典中
- c# - 将声明映射到自定义 ApplicationUser 的属性
- javascript - 在数组中查找 texbox 值匹配
- ios - 使用 UIPageViewController 子类滑动“之后”时出现黑屏
- python - 将 Pandas DataFrame 分成满足条件的行之间的部分
- java - 将流的对象分组到 Map
- hibernate - 我们可以在 Hibernate 中再次使持久对象瞬变吗?
- python - Django:表单无效