Reputation: 137
In VB.net I want to select the first line in a textbox. 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?
Upvotes: 0
Views: 1135
Reputation: 4585
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()
Upvotes: 1