Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InvalidOperationException was unhandled

Status
Not open for further replies.

Dipwind

Technical User
Joined
Nov 19, 2006
Messages
2
Location
GB
Hello,

I'm starting with VB 2005, I build a small and simple interface to teste what I'm learning but I've got an error when adding a invisible control to a form.

"InvalidOperationException was unhandled" saying this
File <make empty> is not a valid file name.

the code is like that:

" Public Class frmViewer

Private Sub btnSelectPicture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectPicture.Click
'Show the open file dialog box.
If ofdSelectPicture.ShowDialog = Windows.Forms.DialogResult.OK Then
' Load the picture into the picture box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName)
' Show the name of the file in te form's caption.
Me.Text = "picture Viewer (" & ofdSelectPicture.FileName & ")"

End If
End Sub

Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
' Close the window and exit the application
Me.Close()
End Sub
End Class"

can somebody help me please, I'm completely blind on this.

Thanks
João

 
which line causes the error?


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Thanks jebenson,

Is that line

If ofdSelectPicture.ShowDialog = Windows.Forms.DialogResult.OK Then




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top