I am trying to save the last used font, font color, and background color. Then when starting myapp up again, read the data and use the last used settings. Make since?
Here is what I have so far:
User pick new font &/or color
Last used font and color saved to fileCode:If FontDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then MainText.Font = FontDialog1.Font MainText.ForeColor = FontDialog1.Color End If FontType = FontDialog1.Font.ToString FontColor = FontDialog1.Color.ToString
Program retrieves last used setting when openingCode:FileOpen(1, Application.StartupPath & "\Settings.txt", OpenMode.Output) WriteLine(1, "Font = " & FontType) WriteLine(1, "FontColor = " & FontColor) FileClose(1)
*** Value of type 'string' cannot be converted to 'System.Drawing.Font'.Code:If System.IO.File.Exists(Application.StartupPath & "\Settings.txt") = True Then FileOpen(1, Application.StartupPath & "\Settings.txt", OpenMode.Input) Do Until EOF(1) Input(1, strinput) If Trim(strinput).StartsWith("Font") Then split = strinput.Split("=") FontType= Trim(split(1)) MainText.Font = FontType '***ERROR HERE End If Loop FileClose(1) End If
Besides getting the value to the right type, it looks like some more trimming will be necessary as well (unless the [brackets] are supposed to be there).
I hope someone out there is smarter than me.




Reply With Quote
