Skip to content

Commit 69ff205

Browse files
committed
Fix 'nominal in frequency' setting reading in Pref_Gui
In the old Registry preferences storage system, the 'frequency in nominal' value was stored as an index of the `Cbx_Freq_Input` combobox control in the `Pref_Gui` preferences form. However, the new Settings system stores the frequency value literally. To work around this, we set the combobox selectedindex value to the first full match with the loaded Settings value. When saving, the value of the selecteditem is read directly into the Settings value.
1 parent f318487 commit 69ff205

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

WinNUT_V2/WinNUT-Client/Pref_Gui.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Public Class Pref_Gui
3636
My.Settings.NUT_AutoReconnect = Cb_Reconnect.Checked
3737
My.Settings.CAL_VoltInMin = CInt(Tb_InV_Min.Text)
3838
My.Settings.CAL_VoltInMax = CInt(Tb_InV_Max.Text)
39-
My.Settings.CAL_FreqInNom = Cbx_Freq_Input.SelectedIndex
39+
My.Settings.CAL_FreqInNom = Cbx_Freq_Input.SelectedItem
4040
My.Settings.CAL_FreqInMin = CInt(Tb_InF_Min.Text)
4141
My.Settings.CAL_FreqInMax = CInt(Tb_InF_Max.Text)
4242
My.Settings.CAL_VoltOutMin = CInt(Tb_OutV_Min.Text)
@@ -116,7 +116,7 @@ Public Class Pref_Gui
116116
Cb_Reconnect.Checked = My.Settings.NUT_AutoReconnect
117117
Tb_InV_Min.Text = My.Settings.CAL_VoltInMin
118118
Tb_InV_Max.Text = My.Settings.CAL_VoltInMax
119-
Cbx_Freq_Input.SelectedIndex = My.Settings.CAL_FreqInNom
119+
Cbx_Freq_Input.SelectedIndex = Cbx_Freq_Input.FindStringExact(My.Settings.CAL_FreqInNom)
120120
Tb_InF_Min.Text = My.Settings.CAL_FreqInMin
121121
Tb_InF_Max.Text = My.Settings.CAL_FreqInMax
122122
Tb_OutV_Min.Text = My.Settings.CAL_VoltOutMin
@@ -188,7 +188,7 @@ Public Class Pref_Gui
188188
Catch Except As Exception
189189
IsShowed = False
190190
Close()
191-
LogFile.LogTracing("Error on Opening Pref_Gui.", LogLvl.LOG_ERROR, Me)
191+
LogFile.LogTracing("Error on Opening Pref_Gui:" & vbNewLine & Except.ToString(), LogLvl.LOG_ERROR, Me)
192192
End Try
193193
End Sub
194194

0 commit comments

Comments
 (0)