Application namespace isn't found? Can anyone help?

View: New views
5 Messages — Rating Filter:   Alert me  

Application namespace isn't found? Can anyone help?

by CajunCoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Everyone,

I'm a long time .NET Windows developer just taking the plunge into Mono. So I've got the following code:

DialogResult dlgRslt;

dlgRslt = MessageBox.Show("Are you sure you want to exit?",
                                                "Confirm Exit",
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(dlgRslt == DialogResult.Yes){
     Application.Quit();
}

Now. this code should work. But it doesn't! Instead, I get told by mono that "The name 'Application' does not exist in the current context"

I am making sure I am using System and using System.Windows.Forms.

Can anyone tell me what might be wrong? Also, I've taken away the () from the statement and I get the same thing.

Thanks!

Re: Application namespace isn't found? Can anyone help?

by Stifu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Did you try prefixing application with the full namespace?
Also, System.Windows.Forms.Application doesn't have a Quit method that I can see. Maybe you meant to use the Exit one?

CajunCoder wrote:
Hello Everyone,

I'm a long time .NET Windows developer just taking the plunge into Mono. So I've got the following code:

DialogResult dlgRslt;

dlgRslt = MessageBox.Show("Are you sure you want to exit?",
                                                "Confirm Exit",
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(dlgRslt == DialogResult.Yes){
     Application.Quit();
}

Now. this code should work. But it doesn't! Instead, I get told by mono that "The name 'Application' does not exist in the current context"

I am making sure I am using System and using System.Windows.Forms.

Can anyone tell me what might be wrong? Also, I've taken away the () from the statement and I get the same thing.

Thanks!

Re: Application namespace isn't found? Can anyone help?

by CajunCoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It seems that when I use System.Windows.Forms.Application.Exit() it works.  Indeed, I did mean Exit() instead of Quit but I hate having to type the full namespace every single time. Oh well.  I have another questions coming up though that *might* give a bit of challenge. lol

Thanks again,
Anthony


Did you try prefixing application with the full namespace?
Also, System.Windows.Forms.Application doesn't have a Quit method that I can see. Maybe you meant to use the Exit one?

CajunCoder wrote:
Hello Everyone,

I'm a long time .NET Windows developer just taking the plunge into Mono. So I've got the following code:

DialogResult dlgRslt;

dlgRslt = MessageBox.Show("Are you sure you want to exit?",
                                                "Confirm Exit",
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(dlgRslt == DialogResult.Yes){
     Application.Quit();
}

Now. this code should work. But it doesn't! Instead, I get told by mono that "The name 'Application' does not exist in the current context"

I am making sure I am using System and using System.Windows.Forms.

Can anyone tell me what might be wrong? Also, I've taken away the () from the statement and I get the same thing.

Thanks!


Re: Application namespace isn't found? Can anyone help?

by Stifu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It *should* work without having to type the full namespace, provided you have the needed project reference and the needed using statement in the concerned class... but from what you said, it seems you already have both, so I don't know what's wrong.


It seems that when I use System.Windows.Forms.Application.Exit() it works.  Indeed, I did mean Exit() instead of Quit but I hate having to type the full namespace every single time. Oh well.  I have another questions coming up though that *might* give a bit of challenge. lol

Thanks again,
Anthony

Stifu wrote:
Did you try prefixing application with the full namespace?
Also, System.Windows.Forms.Application doesn't have a Quit method that I can see. Maybe you meant to use the Exit one?

CajunCoder wrote:
Hello Everyone,

I'm a long time .NET Windows developer just taking the plunge into Mono. So I've got the following code:

DialogResult dlgRslt;

dlgRslt = MessageBox.Show("Are you sure you want to exit?",
                                                "Confirm Exit",
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(dlgRslt == DialogResult.Yes){
     Application.Quit();
}

Now. this code should work. But it doesn't! Instead, I get told by mono that "The name 'Application' does not exist in the current context"

I am making sure I am using System and using System.Windows.Forms.

Can anyone tell me what might be wrong? Also, I've taken away the () from the statement and I get the same thing.

Thanks!

Re: Application namespace isn't found? Can anyone help?

by Alexander Shulgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Stifu wrote:
> It *should* work without having to type the full namespace, provided you have
> the needed project reference and the needed using statement in the concerned
> class... but from what you said, it seems you already have both, so I don't
> know what's wrong.

I'd suggest the OP to post a minimal _complete_ code to reproduce this
problem.

--
Reagards,
Alex
_______________________________________________
Mono-list maillist  -  Mono-list@...
http://lists.ximian.com/mailman/listinfo/mono-list