If the user pressed cancel once the Open file dialog executed, it gave an error.
If I wrap it up around using Try-Catch-EndTry, the error doesn't come up. But I don't know if that's the best way to handle it. Am I wrong? This is my first try at doing a Windows Forms Application so any other tips you can give me would be great!
Thanks in advance
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
Try
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
Catch ex As Exception
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class

New Topic/Question
Reply




MultiQuote



|