Pangeran Zuckerberg
Pangeran Zuckerberg

Reputation: 135

How to Remove the first characters that same as in another textbox : vb6

i have 2 textboxs, text1 and text2

i want to remove the first characters in text1 that same as in text2

text1 = 1234

text2 = 12

Result

text1 = 34

Upvotes: 0

Views: 248

Answers (1)

Ahmad
Ahmad

Reputation: 12727

If you meant to say that you have three textboxes and they have the values:

Text1.Text = "1234"
Text2.Text = "12"

and you want Text3 to contain the remaining text of Text1 that is not common in Text2: then this is what you need to do:

Text1.Text = "1234"
Text2.Text = "12"
Text3.Text = Mid(Text1.Text, InStr(Text1.Text, Text2.Text) + Len(Text2.Text))
'The value in Text3.Text will be "34"

Otherwise, if you want the Result to be stored into Text1 again, just assign the result to Text1 instead of Text3

Text1.Text = Mid(Text1.Text, InStr(Text1.Text, Text2.Text) + Len(Text2.Text))
'The value in Text1.Text will be replaced with "34"

Upvotes: 1

Related Questions