我有以下代码:
txtStatusLog.SelectionStart = 0
txtStatusLog.SelectionLength = 0
txtStatusLog.SelectedText = ("ERROR: " & MyUpdate & "(" & Now & ")" & vbCrLf)
txtStatusLog.SelectionColor = Color.Red
唯一的问题是,当选择不同的颜色时,它永远不会出现或更改整个文本框的颜色。关于如何纠正这个问题的任何想法?
答案 0 :(得分:0)
如果我稍微更改顺序,它看起来有效:
txtStatusLog.SelectionStart = 0
txtStatusLog.SelectionLength = 0
txtStatusLog.SelectionColor = Color.Red
txtStatusLog.SelectedText = ("ERROR: " & MyUpdate & "(" & Now & ")" & vbCrLf)