我想做的是在格式化的(inputmask)文本框中,如果文本框中没有任何内容,则将光标位置设置为第一个位置。但是如果有的话,将位置设置为用户点击过的位置。
现在我有:
If (txtCR.Value = "" Or IsNull(txtCR.Value)) Then
Me.txtCR.SelStart = 0
End If
但是,即使文本框中有内容,光标也会移动到第一个位置。
有没有办法做到这一点?
谢谢!
也许这对您有用吗?(MsgBox行查看您是否获得了正确的值。显然,您可以将其拿出来进行生产。)
If (txtCR.Value = "" Or IsNull(txtCR.Value)) Then
Me.txtCR.SelStart = 0
Else
Me.txtCR.SelStart = Me.txtCR.SelStart + Me.txtCR.SelLength
End If
MsgBox Me.txtCR.SelStart
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句