Hi Andrej,
References and namespaces are completely different things, unfortunately MS has messed up bigtime in this area and made it needlessly complicated, but in short:
- Namespace is the part of a class name that appears before the last dot (if any). So, in class name "System.Windows.Forms.CheckBox", the part "System.Windows.Forms" is called the "namespace". Similarly, in System.Collections.ArrayList, the "System.Collections" part is the namespace. Namespaces are nothing concrete, they are just a naming convention, a way to logically group together many classes with similar scope. Also a class can have no namespace at all (like all classes did in VO).
- References are practically just simple (.Net) dll files (usually called "Assemblies" in .Net) and you choose which ones to use in your apps with the Add References option. Typical such system dll files include "System.dll", "System.Windows.Forms.dll", "mscorlib.dll" (contains all the most important classes like simple data types etc) etc.
The names of the system dlls probably sound like they imply that there's a 1:1 relevance to the namespace of the classes they contain, but unfortunately this is far from true. So for example, System.Windows.Forms.dll indeed contains a class named "System.Windows.Forms.CheckBox", and System.drawing.dll contains "System.Drawing.Point" which makes sense, but System.Windows.Forms.dll also contains class "System.Drawing.BitmapSelectot". And System.Drawing.dll contains a class named "System.Windows.Forms.DpiHelper"! I know it looks very weird, it just needs some getting used to.
In your case, you need to use some classes like "System.Net.Mail.MailMessage", "System.Net.Mail.Attachment" etc. If you search about those classes in msdn:
https://msdn.microsoft.com/en-us/librar ... .110).aspx
you will see in the top of the page:
Attachment Class: Represents an attachment to an e-mail.
Namespace: System.Net.Mail
Assembly: System (in System.dll)
which tells us that this class is defined inside the assembly (dll) System.dll. So, first thing you need to make sure is your app has a reference to this dll, you can open the Application Properties, References page and add this (from the "GAC" list) if it is missing. Alternatively you can press the "Select from template" button and select "Standard Full Framework" to automatically add some commonly used references.
After doing that, now you can use "USING System.Net.Mail" in your code. This tells the compiler to go through all the dlls in the references list and search for classes with names that have this namespace. If no such class is found, then an error is reported (as in your case earlier, because there was no reference to System.dll, so no class was found with that namespace), otherwise the compiler let's you use the "short" names of those classes, for example simply "LOCAL oMessage AS MailMessage" instead of "LOCAL oMessage AS System.Windows.Forms.MailMessage".
Well, this turned out much longer than the "in short" I said in the beginning
Hope I helped making things clearer and not even more complicated!
Chris