I use this code:
NewDesign.CardImage.Image.Save(System.IO.Path.GetDirectoryName(NewDesign.SaveFileDialog1.FileName) + "\" + My.Settings.SaveLoc + "_cardimage" + ".png")
My.settings.SaveLoc
is literally just a string which contains a filename, for example: test
.
It's value is set using:
My.Settings.SaveLoc = System.IO.Path.GetFileName(SaveFileDialog1.FileName)
It worked in the past but suddenly out of nowhere it stopped working.
I used the breakpoints and SaveFileDialog1.FileName
is exactly where expected, in this case "R:\My Pictures\Test Folder"
, also SaveLoc
contains the value I expect it to.
But when it's attempting to save the image, it gives me the error of "Object reference not set to an instance of an object"
and I honestly don't know what I could've possibly done wrong.