Jaroslaw Matlak
Jaroslaw Matlak

Reputation: 574

The type or namespace name 'Forms' does not exist in the namespace 'System.Windows'

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?

Upvotes: 3

Views: 7755

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 156918

Include the System.Windows.Forms assembly 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.

Upvotes: 7

Related Questions