Hi. Just joined. Have question.

System_Code

Member
Joined
Jul 29, 2008
Messages
8
Programming Experience
1-3
Hi. Why cant i import this namespace?

Hi. I am trying to create a keyloger in VB.NET (just for the fun of developing my programming skill). The vbc v3.5 compiler warns me that the System.Windows.Input namespace has no public/inheritable memembers or does not exist with my program-in-progress's first statement:
Imports System.Windows.Input
I know the namespace exists (System.Windows.Input Namespace). Microsoft's page suggests no reason why access should be denied. Anybody know a possible workarround for this? Thanks in advance!
 
It "cannot be found" because you have not referenced any libraries containing that namespace. Check with one or more of the classes you want to use in that namespace to see which assembly they belong to. For example the first class AccessKeyEventArgs you see is in PresentationCore (in presentationcore.dll) assembly. Then check your project references, if you don't have a reference to the mentioned assembly you must first add reference before you can start using it.
 
How do I do vbc.exe?

How would I, say, add a reference to the presentationcore.dll assembly? I program in text files that I compile using vbc.exe v3.5, not using any other user interface that would automate that process for me.
 
See the vbc.exe topic in help. Use the /reference switch.
I program in text files
You mean your application generates text files for dynamic compilation, right?
 
So, how do you import presentationcore.dll

I tried the following code and it diddn't work for adding a reference to AccessKeyEventArgs:
Imports System.Runtime.InteropServices
<DllImport("C:\Windows\winsxs\x86_presentationcore_31bf3856ad364e35_6.0.6001.18000_none_ac31123f8ff4497c\PresentationCore.dll", EntryPoint:= "AccessKeyEventArgsW", SetLastError := True, CharSet := CharSet.Unicode, ExactSpelling := True, CallingConvention := CallingConvention.StdCall)> _
Public Class AccessKeyEventArgs
End Class
I got error BC30662: "Attribute 'DllImportAttribute' cannot be applied to 'AccessKeyEventArgs' because the attribute is not valid on this declaration type." Can anybody help me here?
 
Hello! I have just joined these forums. I am somewhat new to coding and VB.NET, but I can assure you all that I am a fast learner and won't ask too many stupid questions to the annoyance of this community. I use Vista Home Professional, prefer to write my code in notepad and compile it with vbc.exe of the 64 bit VB.NET Framework V3.5 SP1 rather than using Visual Studio, and for my first question, which may seam kind of stupid, I am trying to import the System.Security.Cryptography.X509 namespace into my app using the Imports Statement, and when I try to compile I get: "warning BC40056: Namespace or type specified in the imports 'System.Security.Cryptography.X509' dosen't contain any public member or cannot be found. Make sure the namespace or type is defined and contains at least one public member. Make sure the imported element name dosen't use any alliases." I know the namespace exists because of its discussion at System.Security.Cryptography.X509Certificates Namespace (). As far as I can tell from MSDN some of the classes of the namespace seam to be public members. The installation of the .NET Framework V3.5 and the Service Pack 1 for it were 100% successful, or so it seamed, so I imagine it should be defined in some .dll somewhere. As for alliases, I don't know... Anyway, I was wondering if anyone could help me out on this issue, as any assistance would be greatly appreciated. Thanks in advance, and I'm sure I'll get along well with the members of this community! :)
 
You need to add a reference to the assembly that contains the classes you want to use. The help states which assembly (and namespace) each class belongs to. You should not use the Imports statement, you should instead fully qualify all types, that will help you get more counterproductive.
 
Another Question.

I got it to work. Turns out I thought the name of the namespace was System.Security.Cryptography.X509 when it was really System.Security.Cryptography.X509Certificates. My mistake, really sorry about that. Don't know how I messed that one up. Now, John H, could you give me an example of how I should properly reference the assembly, since I'm kind of new to VB.NET? Lets say I want to use the AuthenticodeSignatureInformation Class under the System.Security.Cryptography.X509Certificates namespace. According to MSDN, it is in the System.Core (System.Core.dll) assembly. Can you give me an example of how I should do this without using an Imports statement? I would really appreciate it, and thanks in advance!
 
Using vbc.exe

I strongly prefer to do everything in notepad. How would I add a reference to an assemly (not import a namespace) if I wanted to strictly use notepad instead of using Visual Studio? Don't ask why, but I really want to learn how to do everything in notepad. I strongly prefer it that way. I have been wanting to learn how to do this in my code for a while, but can't find an good guide on google for how to do it. It is really starting to annoy me. Any help would be greatly appreciated, thanks in advance! :)
 
how I should properly reference the assembly
You should use the Add Reference dialog in Visual Studio
Can you give me an example of how I should do this without using an Imports statement?
It was just a joke, like using Notepad for development is.
 
Back
Top