VB工程--百例64光标位置

VB工程--百例64光标位置,第1张

概述  Option Explicit Private Sub Command1_Click()         txt1.Text = "欢迎来到廊坊师范学院" End Sub Private Sub Command2_Click()         txt1.Text = "" End Sub Private Sub Command3_Click()         End End Sub Pri

Option Explicit

Private Sub Command1_Click()
txt1.Text = "欢迎来到廊坊师范学院"
End Sub

Private Sub Command2_Click()
txt1.Text = ""
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Option1_Click()
txt1.SelStart = 0 '起始点在左侧 选中文本时,Text1.SelStart是“被选中文本的开始位置
txt1.SetFocus '文本框获得焦点
End Sub

Private Sub Option2_Click()
Dim a '定义变量,用于返回文本框中字符的长度
a = Len(txt1.Text) '变量a的值是文本框中文本的长度
txt1.SelStart = a '起点是文本框中字符串的产度
txt1.SetFocus '文本框获得焦点
End Sub

Private Sub Option3_Click()
txt1.SelStart = 0
txt1.SelLength = Len(txt1.Text) '所选择的字符数是文本框中字符的长度
txt1.SetFocus
End Sub

SelLength、SelStart、SelText 属性:http://www10.zzu.edu.cn/ie_wangjunfeng/daquan/property/content/SelLength_SelStart_SelText.htm 总结

以上是内存溢出为你收集整理的VB工程--百例64光标位置全部内容,希望文章能够帮你解决VB工程--百例64光标位置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1288297.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存