How to make an code to works in that way, if the word is on box1, remove ALL from box2.

Theres 3 box and 1 button like that.

Box1: Box2:

Maria Maria really like Joao, but Joao doesnt like she.
like
but


Submit


So after submit, the result is on box 3:

really Joao,he doesnt she.

i hope i understood you correct.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
	Dim reg As New RegularExpressions.Regex("[,.;]") 'add here punctuation if needed
	'remove punctuation and split string by whitespace
	Dim str1() As String = reg.Replace(TextBox1.Text, " ").Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries)
	TextBox3.Text = String.Join(" ", (From st As String In str1 Where Not TextBox2.Text.Split.Contains(st)).Distinct)
End Sub

Returns "Maria really Joao doesnt she"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.