如何将当前日期插入当前选定位置的richtextbox?

How to Insert current Date into richtextbox in the current selected place?

你好,我需要在当前位置的 rtb 中插入当前日期,你能帮帮我吗!

我试过了

AppendText(Environment.NewLine + DateTime.Now.ToString(M/dd/yyyy));

但它在文本框的末尾添加了日期,但我不希望它位于当前选择位置

答案是

tb.SelectionLength = 0;
tb.SelectedText = DateTime.Now.ToString("M/dd /yyyy");