Reputation: 605
i have 3 multi textbox's .. and one button..
it should lookup for the strings or numbers that available in the first textbox and not available in the second each string or number in new line.. and put it in the third on button click::
for example --> the user writes 200 name in the first textbox and 100 name in the second... and he click the button... it should appear the names that are not Available
so ..how to select a Specific line in the multi textbox and get the text from it?
Upvotes: 0
Views: 3368
Reputation: 17288
You can use the following code to get the difference between the two text boxes using LINQ.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
tb3.Lines = tb1.Lines.Except(tb2.Lines).ToArray()
End Sub
Upvotes: 1
Reputation: 158309
The TextBox
control has a Lines
property that returns exactly that (assuming you are doing a WinForms application).
Otherwise it is possible to get the lines from any such string using string.Split
:
Dim lines As String() = input.Split(New String() {Environment.NewLine}, _
StringSplitOptions.RemoveEmptyEntries)
Upvotes: 2