1

私は話していません:

if textbox1.text.contains(textbox2.text) then
textbox1.text = ""
end if

でもこれは:

textbox1 に textbox2 にも存在する文字が含まれている場合、ボタンのクリック時に自動的に削除されます。

ありがとう、

4

3 に答える 3

2

次のようなものを使用できます

textbox1.Text = new String(textbox1.Text.Except(textbox2.Text).ToArray())

または単純なFor Eachループ。

于 2013-09-03T07:57:33.117 に答える
1
  ' btn click event
  Dim unique As List(of String)
  For i As Integer = 0 to textbox2.text.length - 1
    Dim c As String = textbox2.text.substring(i,1)
    If not unique.contains(c)
      textbox1.text = textbox1.text.replace(c, "")
      unique.add(c)
    End If
  Next For
于 2013-09-03T08:01:11.417 に答える
0

次を使用することもできますRegex

textbox1.Text = Regex.Replace(textbox1.Text, _
    "[" & Regex.Escape(textbox2.Text).Replace("-", "\-")  & "]", "")
于 2013-09-04T17:17:49.727 に答える