The type or namespace name 'Form1' could not be found

Mar 15, 2011 at 12:19 PM


When I try a simple example in C# in Visual Studio2008, I get the following error:

error CS0246:
The type or namespace name 'Form1' could not be found (are you missing a using directive or an assembly reference?)

Could you provide an example in C# ?

Thanks !

My sourcecode looks like this:

// Test Nlocalizer
using System;
using System.Windows.Forms;
using NLocalizer;

namespace NLocalizerTest1
    public partial class Form1 : Form
        public Form1()

        private void Form1_Load(object sender, EventArgs e)

        private void englishToolStripMenuItem_Click(object sender, EventArgs e)
            //Translator.Translate("English", this);
            Translator.Translate("English", (NLocalizerTest1.Form1) this);

        private void dutchToolStripMenuItem_Click(object sender, EventArgs e)
            Translator.Translate("Dutch", this);
            //Translator.Translate("Dutch", (NLocalizerTest1.Form1) this);

        private void germanToolStripMenuItem_Click(object sender, EventArgs e)
            //Translator.Translate("German", this);
            Translator.Translate("German", (NLocalizerTest1.Form1) this);

        private void button2_Click(object sender, EventArgs e)
            this.Close();       // Quit




Mar 15, 2011 at 12:40 PM
Edited Mar 15, 2011 at 12:47 PM

Example C# code is included in NLocalizer.Example project. Your .lang files need 4 header lines (see documentation):

locale pl-PL,
module System.dll, System.Windows.Forms.dll, NLocalizer.dll, NLocalizer.Example.exe,
using System, System.Windows.Forms, System.Reflection, NLocalizer, NLocalizer.Example,
static Messages,

Please replace "NLocalizer.Example" as Your project name and I think - it will fix Your error :)

You can remove (NLocalizerTest1.Form1) from lines like this:

Translator.Translate("German", (NLocalizerTest1.Form1) this);
Mar 15, 2011 at 3:06 PM


Thanks KAP, that helped !

It would be nice though if there was some documentation included with your otherwise impressive project.

Something like this:

  Import *.Designer.cs
  Read .cs files
  Get translation
  Write .cs files -> private to public controls
  Choose Form
 Copy English.lang to Dutch.lang
 Edit Dutch.lang
 change header: locale nl-NL
 Change "NLocalizer.Example" to your program name
 Visual Studio
 R-Click References - Add reference - Nlocalizer.dll
 R-Click Project - Add Existing Item - Dutch.lang
 Properties - Copy if newer


Groetjes uit Nederland ...

Mar 16, 2011 at 7:37 AM
Edited Mar 16, 2011 at 8:53 AM


I inserted Your todo list in top of documentation. I will be happy for any further constructive suggestion :)

Sep 2, 2011 at 4:27 PM
Edited Sep 2, 2011 at 4:31 PM

NLocalizer 1.7+ autodetect necessary libraries and don't need any module or using definition.