I'm trying to get an image from my disk. I was using the following code:
Dim img As New BitmapImage(New Uri(fileName, UriKind.Absolute))
book.Imagen.Source = img
fileName is a variable that contains something like: "E:/images//test.jpg"
(after a long headache, I found that "/t" means tab, so I have to use "//t"... I din't knew this for VB but for other languages)
Well, with an existing file, and a right string for it's name, this piece of code is telling me that the file doesn't exist:
>>......If System.IO.File.Exists(fileName) Then
>>.........Dim img As New BitmapImage(New Uri(fileName, UriKind.Absolute))
>>......End If
Just to be sure, I added some code to check wt...:
Dim myOpenFile As New OpenFileDialog
myOpenFile.ShowDialog()
Dim fileName As String
fileName = myOpenFile.FileName
HAHA -I said-, now VB.NET can't tell me that the file doesn't exists
Then I found that NET don't have permission to access that file and I get this exception: "System.Security.Permissions.FileIOPermission"
(In other words, the compiler could tell me that I don't have permission since the begining and don't force me to add code to guess what is happening. I knew the file was there). Something that I am not used to is the NET security model... How should I work on this?
Cheers,
Zameb