简单问题 如何使用代码使光标定位到richtextbox 的末尾

wzfxy 2005-09-06 01:43:32
谢了
...全文
385 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzfxy 2005-09-08
  • 打赏
  • 举报
回复
回复 northwolves(狼行天下)
Private Sub RichTextBox1_Click()
SendKeys "{End}"
End Sub
---------------------
对了。最好是SendKeys "^{End}"
谢谢帮忙。

northwolves 2005-09-08
  • 打赏
  • 举报
回复
这样就可以了,呵呵

Private Sub Form_Load()
RichTextBox1.Text = String(300, "x")
End Sub

Private Sub RichTextBox1_Click()
SendKeys "{End}"
End Sub
bbhere 2005-09-08
  • 打赏
  • 举报
回复
好多热心人啊,学习
flyer_2001 2005-09-07
  • 打赏
  • 举报
回复
RichTextBox1.SelStart = Len(RichTextBox1.Text)
RichTextBox1.SetFocus
xghim 2005-09-07
  • 打赏
  • 举报
回复
在gotfocus事件里加入
RichTextBox1.SelStart=Len(RichTextBox1)

northwolves 2005-09-07
  • 打赏
  • 举报
回复
或许有吧,我也想知道.呵呵
wzfxy 2005-09-07
  • 打赏
  • 举报
回复

回复 northwolves(狼行天下
user a timer:

Private Sub Form_Load()
RichTextBox1.Text = String(300, "x")
Timer1.Enabled = True
Timer1.Interval = 100
End Sub

Private Sub Timer1_Timer()
If Me.ActiveControl = RichTextBox1 Then SendKeys "^{end}"
End Sub

这样虽能实现,但不停地sendkeys好像太浪费资源了,没有别的办法啦
northwolves 2005-09-07
  • 打赏
  • 举报
回复
如果是用鼠标点击richtextbox ,那么还能实现上述效果吗
------------

user a timer:

Private Sub Form_Load()
RichTextBox1.Text = String(300, "x")
Timer1.Enabled = True
Timer1.Interval = 100
End Sub

Private Sub Timer1_Timer()
If Me.ActiveControl = RichTextBox1 Then SendKeys "^{end}"
End Sub
yanshf 2005-09-07
  • 打赏
  • 举报
回复
If richtextbox1.visible=true and richtextbox1.enabled=true then
richtextbox1.setfocus
sendkeys "{end}"
end if
northwolves 2005-09-07
  • 打赏
  • 举报
回复
RichTextBox1.SetFocus
SendKeys "^{End}"
weiweiplay 2005-09-07
  • 打赏
  • 举报
回复
With Text1
.SelStart = Len(.Text)
.SelLength = 1
.SetFocus
End With
happywqw 2005-09-06
  • 打赏
  • 举报
回复
RichTextBox1.SelStart=Len(RichTextBox1)
zjlang 2005-09-06
  • 打赏
  • 举报
回复
当然不能...
wzfxy 2005-09-06
  • 打赏
  • 举报
回复
如果是用鼠标点击richtextbox ,那么还能实现上述效果吗
Kelishating 2005-09-06
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
RichTextBox1.SetFocus
SendKeys "{End}"
End Sub

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧