How to fix it? This is certainly not a mistake, but just a warning.

Here is the code itself:

if (SelectTypeConnectComboBox.SelectedItem == "DSL / Cable / LAN.") { string[] allText = File.ReadAllLines("Settings.cfg"); allText[48] = "NETWORK_SPEEDSETTINGS : 2"; File.WriteAllLines("Settings.cfg", allText); } 

Complete error:

Perhaps an unintended comparison of links; for comparing values, cast the left part to the type "string".

PS Warning here:

 SelectTypeConnectComboBox.SelectedItem == "DSL / Cable / LAN." 
  • And what type of SelectTypeConnectComboBox.SelectedItem ? - Dmitry Polyanin
  • Type ComboBox if correctly understood. From metroFramework. - Pavel Erokhin

1 answer 1

Give the string explicitly:

 if ((string)SelectTypeConnectComboBox.SelectedItem == "DSL / Cable / LAN.") 

But it will be correct only if the strings are stored in your combo box.

  • Thanks, everything works fine. - Pavel Erokhin
  • @PavelErokhin, please, happy to help - Andrew NOP