dim getImage as string
Try
openImage = New OpenFileDialog
openImage.Filter = Nothing
If (openImage.ShowDialog() = Windows.Forms.DialogResult.OK) Then
getImage = openImage.FileName
ptImage.Image = Image.FromFile(getImage)
End If
Catch ex As Exception
Console.WriteLine("Error ButtonBrows")
Exit Sub
End Try
Tag : .NET, VB.NET, VS 2010 (.NET 4.x), VS 2012 (.NET 4.x)
ไม่ IF เอาครับ ถ้าภาพว่างก็ให้ไปเลือกจากภาพที่เป็น Default ครับ
Code
dim getImage as string
Try
openImage = New OpenFileDialog
openImage.Filter = Nothing
If (openImage.ShowDialog() = Windows.Forms.DialogResult.OK) Then
getImage = openImage.FileName
IF IsNothing(getImage) Then
ptImage.Image = Image.FromFile(getImage)
Else
ptImage.Image = Image.FromFile(Default Image)
End IF
End If
Catch ex As Exception
Console.WriteLine("Error ButtonBrows")
Exit Sub
End Try