I had a user control with Sqlite. After Compiled and Added to the Tool Box, by dragging it into a new Form,an Error Message as described Below:
"Failed to Create Component 'UserControl1'. The Error Message follows 'System.DllNotFoundException: 'Unable to Load Dll 'Sqlite.Interop.dll' : The Specified Module could not be found. Exception from HResult: 0x8007007E
I googled on this subject, I'm still unable to resolved this issue. But the funny parts is If I hard coded it in the Form by reference and create a new control, the user control worked. Why Drag and Drop had this problem?
One more Question: I'm using Nuget to install sqlite, there are 2 version: 32 and 64 bit: which one should i add as reference? I'm using VS2010 ultimate sp1. Sqlite v 22.214.171.124. Compiled dll as any cpu.
I think this is an issue separate from SQLite and more specifically deals with the DLL not being found when you try to drag the user control from the Toolbox. I had the same problem. I was able to programmatically add the user control via
Controls.Add(myUserControl) and it worked fine but I couldn't drag it from the Toolbox. Some searching led me to the following link with insight from Hans Passant:
The gist is that the Designer doesn't know the path for where to look for the DLL. As a test, I hard-coded the path within
[DllImport(*full path here*)], and I was able to successfully drag the user control from the Toolbox to the Designer. (Make sure you do a build after adding the full path before trying to add the user control!)
Without any major testing, it seems I was then able to then remove the fully qualified path and the Designer seemed to remember where to look. I could delete the user control from the form and add it again without issue. Once I closed Visual Studio and re-opened it, though, dragging and dropping the user control from the Toolbox failed again. Hopefully this information can help someone understand what's going on and/or lead them in the right direction for a solution.
User contributions licensed under CC BY-SA 3.0