garriew
Member
- Joined
- Sep 13, 2013
- Messages
- 13
- Programming Experience
- Beginner
When my program loads, it's suppose to look for a settings file and if the file isn't found it's suppose to go ahead and load but use hardcoded variables. Then the file is created on exit.
In testing it works but after I compile it, I get the error an Unhandled Exception Error. It says:
System.IO.FileNotFoundException: Could not find file 'C:\Users\main\Desktop\settings.ini'.
If I click continue it loads the default settings load like they should.
My code is:
(This is done before anything and is in the public)
My onload has:
In testing it works but after I compile it, I get the error an Unhandled Exception Error. It says:
System.IO.FileNotFoundException: Could not find file 'C:\Users\main\Desktop\settings.ini'.
If I click continue it loads the default settings load like they should.
My code is:
(This is done before anything and is in the public)
VB.NET:
Dim fileSettings As String = "C:\Users\main\Desktop\BingRewardsSearchBot.ini"
My onload has:
VB.NET:
Dim ini As New IniFile(fileSettings)
Dim MyFile As String = fileSettings
Dim myFileLines() As String = IO.File.ReadAllLines(fileSettings)
Dim myListOfWords As New List(Of String)
'load settings
If System.IO.File.Exists(MyFile) = True Then
Dim delay = ini.ReadValue("settings", "delay")
SearchDelay.Text = delay
Dim search = ini.ReadValue("settings", "search")
NoSearches.Text = search
For Each strWordLine As String In myFileLines.Where(Function(x) x.StartsWith("Word"))
myListOfWords.Add(strWordLine.Split("="c).Last)
Next
SearchWords.Text = String.Join(Environment.NewLine, myListOfWords.ToArray)
Else
SearchDelay.Text = "7-12"
NoSearches.Text = "32-35"
End If