对于选定行中的每一行 (vb.net)
如何获取其中包含选定文本的行? 例如:
所选行为 1、2,3 和 4(0 为第一行)
我怎样才能得到这样的代码:
For Each line as string(or integer) in textbox1."SelectedLines"
'Do something here for each line
Next
谢谢
how can I get the lines which are have selected text in them?
For example:
The selected lines would be 1, 2,3 and 4 (0 being the first line)
How can I get to code like:
For Each line as string(or integer) in textbox1."SelectedLines"
'Do something here for each line
Next
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您正在寻找 SelectedText 属性。
(在 C# 中)
(在我尝试 VB 中)
I think you're looking for the SelectedText property.
(in C#)
(in my attempt at VB)
从字面上看,您需要找到行号,即使只选择了第 1 行和第 4 行的部分内容。执行如下操作:
Taking you literally, you need to find the line numbers, even though only parts of line 1 and 4 are selected. Do that as follows: