我有这个搜索字符串。
Dim files As String() = IO.Directory.GetFiles("\\192.168.0.2\shares\be\" & functiicomune.numeclient & "\" & r & " " & codnumeric & "*" & "\" & "PROD\", "*" & codnumeric & "*" & "DECOMPOSITION" & "*" & ".pdf")
我在路上得到非法字符,我不知道为什么。有人可以提供提示吗?
网络上的路径是:
\\192.168.0.2\shares\be\BERTHOUD\BA 390683 L\PROD\BA390683 L - PP. DECOMPOSITION 160630.pdf
numeclient函数代码是:
Public Shared Function numeclient()
Dim codclient As String = Form1.TextBox4.Text.Substring(0, 2)
Dim r As String
Select Case codclient
Case "BA"
r = "BERTHOUD"
Case "CN"
r = "CARUELLE"
Case "TT"
r = "TECNOMA"
Case "PR"
r = "PRECICULTURE"
Case "KR"
r = "KREMLIN"
End Select
Return r
End Function
r和codnumeric代码是:
Dim rgx As New Regex("[^0-9]")
Dim codnumeric As String = rgx.Replace(TextBox4.Text, "")
Dim r As String = TextBox4.Text.Substring(0, 2)
textbox4包含以下形式的字符串:BA390683 L
答案 0 :(得分:0)
您可以先简化代码,并在调用函数时添加括号:
Dim files As String() = IO.Directory.GetFiles("\\192.168.0.2\shares\be\" & functiicomune.numeclient() & "\" & r & " " & codnumeric & "*PROD\","*" & codnumeric & "*DECOMPOSITION*.pdf"
,其次,通过调试器检查组成路径或扩展的值:
functiicomune.numeclient
r
codnumeric