Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My program creates a file which has a path writen to it then when the program starts up again the path should be the text of the textbox (TextBoxX4), then the picture of an image(BackImage) should be the path of the textbox. Only problem is the fact that it isn't loading the picture and instead comes up with an error saying that the path is not of legal form (i check what the path is and it looks fine (it has the "\" and the "C" in the beginning etc.)).

This is where the error is happening: This is a link leading to an image of the code (opens in current tab)[^]
Posted
Updated 1-Jan-14 15:46pm
v2
Comments
Dave Kreskowiak 1-Jan-14 22:44pm    
Without seeing your path as loaded by the ReadLine statement, it's pretty much impossible to tell you what went wrong with the information you provided.
[no name] 2-Jan-14 0:08am    
The user selects an image file (with openfiledialog), which changes the text of the textbox to the filename of the openfiledialog and changes the image of "BackImage" with the filename, then when the user closes the window it writes the text of the textbox (filename) to a textfile.
Then when I view the textfile, the path is correct (no errors or spaces of some sort).
When I start up the window it should load the path or filename in the textfile to the textbox and then the image (BackImage) should load the filename from the textbox or textfile. Only problem is the fact that when it gets to the code for loading the image from the textfile or textbox, it comes up with an error saying that the path is not of legal from.
Dave Kreskowiak 2-Jan-14 0:11am    
Again, what did I ask you...

I don't care about what you THINK the code is doing. I care about what the code thinks.
[no name] 2-Jan-14 0:16am    
The code thinks that the filename is not correct...
Dave Kreskowiak 2-Jan-14 10:49am    
http://forums.riftgame.com/attachments/general-discussion/9358-open-challenge-daglar-picard-facepalm.jpg

1 solution

Fixed!

VB
Dim rdr4 As New IO.StreamReader(Application.StartupPath & "\LumiaBrowser3_Settings5.lbrst")
            Dim t As String = rdr4.ReadLine
            rdr4.Close()
            If t = "GlassYHnVGTghXY7VFG5g6Y78j" Then
                BStyleG.Checked = True
                BStyleI.Checked = False
                TextBoxX4.Enabled = False
                ButtonX8.Enabled = False
                IsBackImage = False
            Else
                TextBoxX4.Enabled = True
                ButtonX8.Enabled = True
                BStyleI.Checked = True
                BStyleG.Checked = False
                TextBoxX4.Text = t
                BackImage = Image.FromFile(TextBoxX4.Text)
                ThemePictureBox.Image = BackImage
                IsBackImage = True
            End If
            rdrTST.Close()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900