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 optieofdOpen.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
Vimal KandasamyPosted May 26, 2009, 4:05 AM
in if condition,
! operator will return true if(!(false))
and will return false if(!(true))
to check whether file is selected or not try to use some other way u cant use ! operator.