Hailei Edwards
Hailei Edwards

Reputation: 137

vb.net select first line in textbox

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

Answers (1)

Tariqulazam
Tariqulazam

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

Related Questions