Q:

Problems with MessageBox.Show()

I'm new to code and most things work, but I can't get this code to run. Can someone help?
I tried using System.Forms but it showed as missing a namespace. When I used using System.Windows.Forms that message went away. It does not let me use both.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamReader sr = new StreamReader(@"file.csv");
            // for set encoding
            // StreamReader sr = new StreamReader(@"file.csv", Encoding.GetEncoding(1250));

            string strline = "";
            String[] _values = null;
            int x = 0;
            while(!sr.EndOfStream)
            {
                strline = sr.ReadLine();
                _values = strline.Split(',');
                if (_values.Length >= 6 && _values[0].Trim().Length > 0)
                {
                    MessageBox.show(_values[1]);
                }
            }
            sr.Close();

        }
    }
}

A:

There is no such namespace System.Forms, the class you were trying to use (MessageBox) is in System.Windows.Forms. By correcting your using statement, the error went away.
Remember, you must have a reference to System.Windows.Forms.dll in your console app to use this class.

A:

You need to reference System.Windows.Forms.dll in your project. Here is a detailed instruction how to do that.

A:

There is no such namespace as System.Forms there is only a namespace called System.Windows.Forms, wich has the MessageBox class you are talking about. To be able to use it, you need to add a reference to the System.Windows.Forms.dll to to your project (find it in the .NET Tab in the "Add Reference ..." dialog) and it will work. Also note that MessageBox.Show() requires a capital 'S'. Please see below an optimized and fully working version of your code.
using System.IO;
using System.Windows.Forms;

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            using (StreamReader sr = new StreamReader(@"file.csv"))
            {
                while (sr.Peek() >= 0)
                {
                    string strline = sr.ReadLine();
                    string[] values = strline.Split(',');
                    if (values.Length >= 6 && values[0].Trim().Length > 0)
                    {
                        MessageBox.Show(values[1]);
                    }
                }
            }
        }
    }
}

