简体   繁体   English

vb.net中的多行文本框

[英]multi line textbox in vb.net

i have 3 multi textbox's .. and one button.. 我有3个多文本框的..和一个按钮..

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 例如->用户在第一个文本框中输入200个名称,在第二个文本框中输入100个名称...,然后单击按钮...,它应该显示不可用的名称

so ..how to select a Specific line in the multi textbox and get the text from it? 所以..如何在多文本框中选择特定行并从中获取文本?

The TextBox control has a Lines property that returns exactly that (assuming you are doing a WinForms application). TextBox控件具有Lines属性,该属性精确返回该属性(假设您正在执行WinForms应用程序)。

Otherwise it is possible to get the lines from any such string using string.Split : 否则,可以使用string.Split从任何这样的字符串中获取行:

Dim lines As String() = input.Split(New String() {Environment.NewLine}, _
                                    StringSplitOptions.RemoveEmptyEntries)

You can use the following code to get the difference between the two text boxes using LINQ. 您可以使用以下代码使用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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM