XML Reading Problem ( Operator '!' cannot be applied to operand of type 'string' )

May 26 2009 3:17 AM

Dear  all ,

 

I'm programming now for a few months active in c# but i have now an problem i don't see .

Maybe can someone explaine what i doing wrong .

 

I try to check if file is already selected see here for .

Here is code  :

 

private void btRead_Click(object sender, System.EventArgs e)

{

OpenFileDialog ofdOpen = new OpenFileDialog(); //New openfile optie

ofdOpen.Filter = "XML-files(*.xml *.html)|*.xml;*.html|All Files (*.*)|*.*";

ofdOpen.ShowDialog(this); // Openen van Dialog.

if (!(ofdOpen.FileName)) //Controle of bestand is gekozen.

{

//Inlezen van bestand

}}

private TreeNode ReadXML(string xmlfile)

 

 

And i get the error on this :  if (!(ofdOpen.FileName))

Error : Operator '!' cannot be applied to operand of type 'string'

 

I'm sorry but i don't know where to look.

 

Please help.

 

Kind regards,

 

Peter Jennissen


Answers (1)