在vb.net中合并高级文本框

时间:2013-09-02 06:14:43

标签: vb.net textbox merge

有没有办法合并这样的文本框:

textbox1 : O N E
textbox2 : T W O

因此,当我合并它时,它看起来像:

O T N W E O

1 个答案:

答案 0 :(得分:1)

你应该为你的文本框文本做一个循环..

Function MyMerge(byval string1 as string, byval string2 as string) as string
Dim x as Integer iif(string1.Length >= String2.Length, String2.Length, String1.Length )
For i as Integer = 1 to x
  MyMerge &= iif(string1.length >= x, string1.substring(i-1,1),"") 
  MyMerge &= iif(string2.length >= x, string2.substring(i-1,1),"")
Next

End Function 

所以,您可以通过..

来使用它
Msgbox(MyMerge(TextBox1.Text, TextBox2.Text))