type or namespace name 'MessageBox' does not exist in the namespace 'System.Windows' (are you missin

M

mp

I just copied some classes in to a new project folder
I renamed all namespaces to the new project namespace (which is probably
wrong but that's another post)
now I get this error (in the subject line)
not sure what i'm doing wrong here(see catch block below)

using System.Windows;
[etc...]

namespace BrowserApp
{
...
//constructor
public cFile(string FileName)
{
_fileName = FileName;
if (File.Exists(_fileName))
{
try
{
StreamReader _fileReader = File.OpenText(_fileName);
}
catch (Exception ex)
{
//MessageBox.Show("Exception " + ex.Message);
<------------ //orignally tried
//when got error tried
System.Windows.MessageBox.Show("Exception " +
ex.Message); <------------still error here
throw;
}

}

thnsks for any tips
mark
 
M

mp

mp said:
I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);

ok, if i change
using System.Windows;
to
using System.Windows.Forms;

the error goes away....

case closed
thanks
mark
 
J

Jeff Johnson

I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);

ok, if i change
using System.Windows;
to
using System.Windows.Forms;

the error goes away....

case closed

Everything that starts System.Windows and ISN'T
System.Windows.Forms[.Design] is for WPF.
 
M

mp

Jeff Johnson said:
I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);

ok, if i change
using System.Windows;
to
using System.Windows.Forms;

the error goes away....

case closed

Everything that starts System.Windows and ISN'T
System.Windows.Forms[.Design] is for WPF.

ah! thanks for that. didn't know
did you take a course in c# when moving from vb6 or just read books or just
intuitively brilliant?
mark
 
A

Arne Vajhøj

mp said:
I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);

ok, if i change
using System.Windows;
to
using System.Windows.Forms;

the error goes away....

If you google:
messagebox show
then it is rather easy to find.

Arne
 
M

mp

Arne Vajhøj said:
mp said:
I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);

ok, if i change
using System.Windows;
to
using System.Windows.Forms;

the error goes away....

If you google:
messagebox show
then it is rather easy to find.

Arne

I'll try and remember to google also...usually i search msdn through help in
the ide since i'm there at the time
i had recently been working in wpf so i knew there was both a Windows and a
Windows.Forms MessageBox
what i didn't realize was Windows was wpf only so when i switched to a
windows Forms project i didn't understand
why i wasn't getting a MessageBox when I had [using System.Windows]

thanks
mark
 
J

Jeff Johnson

Everything that starts System.Windows and ISN'T
System.Windows.Forms[.Design] is for WPF.

ah! thanks for that. didn't know
did you take a course in c# when moving from vb6 or just read books or
just intuitively brilliant?

Perseverence.

When I started C# I was pretty much lost. No, wait, that's not true. C# was
pretty easy since I had worked with C, and the pieces that weren't very
C-like (properties, events) I knew from VB! So the C# LANGUAGE was not too
hard for me to get into.

The .NET Framework was another matter entirely. I had no Java experience so
I was unable to draw parallels with its framework. (Unlike a few months ago
when I started studying Java so I could write programs for my Android
phone!) Basically I would hit MSDN for almost any piddly little thing I
needed to do. And after you do task x several times you stop needing to look
it up and bing! you've learned something. (It was the same way in my
transition from RDO to ADO in VB. I thought I'd NEVER learn the new objects.
Now I can write ADO code in my sleep.)

I did a personal project that involved reading and writing binary files and
manipulating bytes in memory. I had had a very tough time understanding
streams (in any form) before then. After all the stream reading and writing
code I put into that project I came out the Stream Master. That was focused
learning, because I did a whole lot of work with a particular namespace at
one time. Then there's the osmosis kind of learning; you do something
occasionally enough times and it sinks in.

All that said, it doesn't hurt that I'm smarter than the average bear. Or at
least that's what all my teachers used to tell me....
 
A

Arne Vajhøj

Arne Vajhøj said:
I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);

ok, if i change
using System.Windows;
to
using System.Windows.Forms;

the error goes away....

If you google:
messagebox show
then it is rather easy to find.

I'll try and remember to google also...usually i search msdn through help in
the ide since i'm there at the time

Somehow I think the MSDN people are better at SEO
making their pages almost always top hit at Google
than creating embedded help systems.

I prefer using the web for .NET docs.

Arne
 
M

mp

Arne Vajhøj said:
Arne Vajhøj said:
On 16-12-2010 15:36, mp wrote:
I just copied some classes in to a new project folder
using System.Windows;
[etc...]
//MessageBox.Show("Exception " + ex.Message);
[...]>
Somehow I think the MSDN people are better at SEO
making their pages almost always top hit at Google
than creating embedded help systems.

I prefer using the web for .NET docs.

Arne

i'll remember that
mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top