I can’t even get off the ground.I DO KNOW HOW TO ADD REFERENCES, (this.”””mshtml””” NOT[working])
using System;
using system.text;
using mshtml; // i cant seem to access this
I’m confused on why when I type mshtml it’s in capitals, MSHTML. The problem I’m having is I’m just using a variety of tutorials but can’t seem to even start them as this is my first problem.
I have manually browsed when adding references to my application but it doesn’t seem to work. I keep getting the capital letter version, except there is no capital letter version of MSHTML.dll in my directories on my PC. If for some reason I don’t have this file can it been downloaded for free safely or are my tutorials just too old?
Also just to let you know I understand where these files are meant be, in regards to folders locations ect. I thought if I just add the reference in to my project it should just be there.
Thank you for pointing out that this is your first C# program. It helps us understand the level at which to try to answer.
First, I’d like to address a statement you made:
It seems that you’re confusing Namespaces with .dll names, which is something I struggled with myself at first. There’s a full explanation here, but it may be too technical for beginner level developers.
In a nutshell, at the top of the file where your “using” statements are, you’re telling the compiler where to look for certain classes and code by Namespace.
A Namespace is a logical grouping of code. For convenience and clarity, developers group similarly functioning code into Namespaces. For example, Data Access code is in the System.Data Namespace.
When adding a .dll you’re adding an actual file reference. In a less-confusing world, .dlls would be named to reflect the Namespaces contained within them. However, it’s not always that simple. It’ is perfectly possible for me to create a dll named “DaveStratton.dll” that contains Booyah.Encryption, Simple.Functions or any other Namespace I want. There really is no correlation except by convention, and it’s not enforced.”
For example, if you look in the MSDN Library at the System.Data.SqlConnection class.
The Class name is actually SqlConnection, and it lives in the System.Data Namespace. The System.Data Namespace is contained in the System.Data.dll. (because the developers were following convention and did it this way for clarity.) Screenshot below:
If you look at other classes, you may find discrepancies.
For example, the System.Configuration.SettingsBase class: The SettingsBase class in in the System.Configuration namespace, but if you look at the assembly information, you’ll see that it’s in System.dll. And the System.Configuration.ConfigurationManager is in the System.Configuration.dll.
So, long story short, you need to know the Assembly (.dll) name when adding a reference in Visual Studio, but you need the class/assembly name when writing your code. In your using statement, you need capital letters because the Namespace is capitalized, ewven if the .dll isn’t.