我需要採取前5個字符,以便他們匹配備份與我保存早的相同名稱的圖片框。左修剪Path.GetFileNameWithoutExtension
這個文件名作爲例子可能是12345_Text_Text_Text.pdf
Dim key As String = Path.GetFileNameWithoutExtension(e.Name)
Dim p As PictureBox = CType(Me.Controls(key), PictureBox)
p.Image = My.Resources.Ok
我認爲這樣做會一直工作;
Dim subkey As String
Dim key As String = Path.GetFileNameWithoutExtension(e.Name)
subkey = Left(key, 5)
這個問題似乎在Left
命令,Public Property Left As Integer' has no parameters and its return type cannot be indexed.
全部子程序在這裏;
Private Sub Watcher_Changed(ByVal sender As Object, ByVal e As FileSystemEventArgs) Handles Watcher.Changed
Dim key As String = Path.GetFileNameWithoutExtension(e.Name)
Dim subkey As String
subkey = Left(key, 5)
Dim p As PictureBox = CType(Me.Controls(key), PictureBox)
p.Image = My.Resources.Ok
End Sub
關於我在做什麼錯誤的建議?
「所以我有麻煩」什麼似乎是麻煩? – aquinas
什麼問題? – estebane97