[英]vb.net select first line in textbox
In VB.net I want to select the first line in a textbox. 在VB.net中,我想在文本框中选择第一行。 This is my code:
这是我的代码:
WebBrowser1.Document.GetElementById("Email").SetAttribute("value", TextBox1.Text)
But this selects the entire box, How can I change this so it only gets the first line? 但这会选择整个框,如何更改它,使其仅获得第一行?
You can try this, provided that you add some error handling: 如果您添加了一些错误处理,则可以尝试以下操作:
Dim arr() As String
arr = New String() {Environment.NewLine}
WebBrowser1.Document.GetElementById("Email").SetAttribute("value",TextBox1.Text().Split(arr, StringSplitOptions.None)(0).ToString()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.