以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]如果这个改成文本框的该怎么弄?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141325)

--  作者:hrlong
--  发布时间:2019/9/26 19:01:00
--  [求助]如果这个改成文本框的该怎么弄?
论坛的这个代码是识别省市县区的;
但是我的这个具体地址是在一个文本框TextBox1里;
并且识别后,把省赋值到省份列;市赋值到市列
请问老师这个代码该怎么改呢?

Dim str As String = "江苏省南京市秦淮区石头街华泰家园111-205室华宏装饰工程有限公司"
Dim mc = System.Text.RegularExpressions.Regex.Matches(str, ".+(?=
)")
If mc.count = 1 Then
    msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=
).+(?=)")
If mc.count = 1 Then
    msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=
).+(?=)")
If mc.count = 1 Then
    msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=
).+")

if mc.count = 1 then
    msgbox(mc(0).value)
end if


--  作者:有点蓝
--  发布时间:2019/9/27 8:26:00
--  
Dim str As String = e.form.controls("TextBox1").text
--  作者:hrlong
--  发布时间:2019/9/27 13:39:00
--  


谢谢


另外 原来代码的这个是跳出窗口显示的;如何把这个改成赋值到文本框里呢?

就是把这个值显示到TextBox2



Dim str As String = "江苏省南京市秦淮区石头街华泰家园111-205室华宏装饰工程有限公司"
Dim mc = System.Text.RegularExpressions.Regex.Matches(str, ".+(?=
)")
If mc.count = 1 Then
 
   msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=
).+(?=)")
If mc.count = 1 Then
    msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=
).+(?=)")
If mc.count = 1 Then
    msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=
).+")

if mc.count = 1 then
    msgbox(mc(0).value)
end if


--  作者:有点蓝
--  发布时间:2019/9/27 14:11:00
--  
同样道理呀: e.form.controls("TextBox1").text = mc(0).value