[英]Loop through file extensions
Try
Dim lImage As Image = Image.FromFile(appPath + "\" + "ActiveDisplay" + "\" + "Helmets" + "\" + vData + **"extension loop need"**)
ResizePicture(Me.PictureBox1, lImage)
Catch ex As Exception
End Try
I'm searching for a image name in viewer and need to loop through extensions any help would be appreciated 我正在查看器中搜索图像名称,需要遍历扩展名,我们将不胜感激
You can use a String array and a For Each 您可以使用String数组和For Each
Dim extensions As String() = {".png", ".jpg", ".bmp"}
For Each ext As String In extensions
Dim file As String = appPath + "\" + "ActiveDisplay" + "\" + "Helmets" + "\" + vData + ext
'I recomend use: Dim file As String= String.Format("{0}\ActiveDisplay\Helmets\{1}\{2}", appPath, vData, ext)
If IO.File.Exists(file) Then
Dim lImage As Image = Image.FromFile(file)
End If
Next
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.