I need to select json file.
public void LoadChartData()
{
var ofDialog = new System.Windows.Forms.OpenFileDialog { Filter = @"json (*.json)|*.json" };
if (ofDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{ }
}
Unfortunately compilation of this code returns error (twice, for each System.Windows.Forms ):
Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
How to handle with this error?
Include the
System.Windows.Formsassembly in your project (as the error message suggested).Go to your Solution Explorer, right click your project. Then click Add Reference. Choose System.Windows.Forms and hit OK.