以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  按钮录入的代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=55439)

--  作者:yangwenghd
--  发布时间:2014/8/16 17:49:00
--  按钮录入的代码
Dim s As String = ClipBoard.GetText()
s = s.Replace(chr(10), "").Replace("Address", chr(13) & "Address").Replace("Zip Code", chr(13) & "Zip Code").Replace("Mobile", chr(13) & "Mobile").Replace

("Tel", chr(13) & "Tel").Replace("No", chr(13) & "No")
Dim nr As Row = Tables("客户订单表").AddNew
nr("客户_详解") = s
For Each str As String In s.Split(Chr(13))
    Dim ss As String() = str.Split(":")
    If ss.length > 1 Then
        Dim cs As String = ss(0)
        Select Case cs.trim()
            Case "Contact Name"
                nr("客户_姓名")=ss(1)
            Case "Address"
                nr("客户_地址")=ss(1)
            Case "Zip Code"
                nr("客户_邮编")=ss(1)
            Case "Mobile"
                nr("客户_电话")=ss(1)
            Case "Tel"
                nr("客户_固话")=ss(1)
            Case "No"
                nr("No")=ss(1)
        End Select
    Else
       nr("客户_地址") = nr("客户_地址") & ss(0)
    End If
Next

Contact Name: Kellen Borba Skolimovski de Oliveira
Address: Rua Desembargador Westphalen, 1669
         Oficina
         Curitiba, Parana, Brazil
Zip Code: 

80230100
Mobile: 55-041-9854-3338
Tel: 55-041-3045-6787
No: 63393059665475


Contact Name: Andre lima de jesus
Address: R:Rio Branco N:150
         Praia da costa
         vila velha, Espirito Santo, Brazil   (在按钮录入Address的时候只是录入了R ,可不可以改为录入R:Rio Branco N:150 Praia da costa vila velha, Espirito Santo, Brazil,找到的规律是:在Address:后面切在Zip Code:前面类容录入到"客户_地址"列)感谢 感谢 
Zip Code: 29101130
Mobile: 

5527999094016
Tel: 55-27-30620745
No: 63430391861011

能帮我看看吗 为什么后面的那个数据不能录入呢!
感谢感谢 
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:数据.txt


[此贴子已经被作者于2014-8-16 18:15:51编辑过]

--  作者:有点甜
--  发布时间:2014/8/17 9:59:00
--  
  没有问题啊,测试没有问题啊。
--  作者:yangwenghd
--  发布时间:2014/8/17 19:56:00
--  

Contact Name: Andre lima de jesus
Address: R:Rio Branco N:150
         Praia da costa
         vila velha, Espirito Santo, Brazil
Zip Code: 29101130
Mobile: 5527999094016
Tel: 55-27-30620745
No: 63430391861011
在记事本复制这个的时候,(在记事本里面复制)在点击按钮,地址的那一列就无法输入,感谢 感谢 

--  作者:有点甜
--  发布时间:2014/8/17 20:07:00
--  

代码改一下

 

Dim s As String = ClipBoard.GetText()
s = s.Replace(chr(10), "").Replace("Address:", chr(13) & "Address|").Replace("Zip Code:", chr(13) & "Zip Code|").Replace("Mobile:", chr(13) & "Mobile|").Replace("Tel:", chr(13) & "Tel|").Replace("No:", chr(13) & "No|")

Dim nr As Row = Tables("客户订单表").AddNew
nr("客户_详解") = s
For Each str As String In s.Split(Chr(13))
    Dim ss As String() = str.Split("|")
    If ss.length > 1 Then
        Dim cs As String = ss(0)
        Select Case cs.trim()
            Case "Contact Name"
                nr("客户_姓名")=ss(1)
            Case "Address"
                nr("客户_地址")=ss(1)
            Case "Zip Code"
                nr("客户_邮编")=ss(1)
            Case "Mobile"
                nr("客户_电话")=ss(1)
            Case "Tel"
                nr("客户_固话")=ss(1)
            Case "No"
                nr("No")=ss(1)
        End Select
    Else
       nr("客户_地址") = nr("客户_地址") & ss(0)
    End If
Next