tags:

views:

279

answers:

2

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?

+1  A: 

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)
Fredrik Mörk
i tryed that ... it gives me 'line ' is not a member of 'System.web.ui.webcontrol.textbox1'
jjj
Input is Overload 'failed'
jjj
@jjj: The `Lines` property exists only in the winforms `TextBox` class; not the web one. You should go for the second approach; using the `Split` method on on the string returned by the `Text` property.
Fredrik Mörk
+1  A: 

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
Hemanshu Bhojak