这个VB怎么做?

来源:百度知道 编辑:UC知道 时间:2024/06/02 07:50:20
就是在text1中输入一段字符,要求截取"age="后到"&"前的所有字符,并把字符插入到另一段字符的"year="后到"&"前,按下command1后显示在text2中
如在text1中输入:wqeqwewqeqewqage=66179AE59D32540D450BFD53C047353AD2B0D89&213qwead
在text2中显示:qwewqeqeyear=66179AE59D32540D450BFD53C047353AD2B0D89&213erwrfbdg
请问要怎么写,请给出代码,谢谢!

建一个Command1,Text1,Text2。
代码如下。
============
Private Sub Command1_Click()
Dim t1 As String, p As Integer, t2 As String
t1 = Text1.Text
p = InStr(1, t1, "age=")
t1 = Mid(t1, p + 4, InStr(p, t1, "&") - p - 4)
t2 = Text2.Text
t2 = Left(t2, InStr(1, t2, "year=") + 4) & t1 & Mid(t2, InStr(1, t2, "&"))
Text2.Text = t2
End Sub

Private Sub Form_Load()
Text1.Text = "wqeqwewqeqewqage=66179AE59D32540D450BFD53C04733333333353AD2B0D89&213qwead"
Text2.Text = "xxxxxyear=&xxxxx"
End Sub

command1_click()
dim x,y as integer
x=instr(text1.text,"="):y=instr(text1.text,"&")
text2.text="qwewqeqeyear=" & mid(text1.text,x+1,y-1-x) & "&213erwrfbdg "
end sub

同意 43295811 - 江湖少侠 六级

command1_click()
dim x,y as integer
x=instr(text1.text,"="):y=instr(text1.text,"&&qu