Click here to Skip to main content
14,773,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I add the Agauge control to the VB.net (2008) toolbox?
I tried the general purpose ways described on the internet but it gives an error each time. Using the right-click menu gives an error that the dll "..is not a Microsoft.Net module", or "the type library could not be loaded". Even dragging the dll to the toolbox does nothing.


I just found there is a dedicated question section for this control, so I have started a question there and pointed to this. I will continue there so the thread is more easily found in relation to the control. (See https://www.codeproject.com/Articles/448721/AGauge-WinForms-Gauge-Control?msg=5759030#xx5759030xx)

What I have tried:

Using the right-click menu to choose item; and dragging the dll to the toolbox.
Posted
Updated 30-Oct-20 11:02am
v2

After unzipping the zip folder, please make sure the actual .dll is not being blocked. Visual studio will allow you to add a .dll as a reference even if the .dll is being blocked, the key here is to make sure the .dll as well as any and all other .dlls that were uncompressed are not blocked. You can unblock all dlls by performing these steps on your computer.

Step 1 - Unzip the original archive.
Step 2 - Select the contents of the unzipped files and compress them as a zip folder.
Step 3 - Unzip your zip folder from step 2.

When you compress a folder on your computer, than Info from your computer will be added to it's contents. When the contents are unzipped on your computer the info will match and none of the files will be blocked.

You are absolutely right by posting your question where the control is documented, it is usually the best place to obtain help.
   
Comments
CHill60 30-Oct-20 5:09am
   
Did you know that you can use the "Improve Solution" link to add information to your existing solution? If it doesn't show straight away hover your mouse over your post and it should appear in the bottom right of your post. That is preferable to posting multiple solutions to the same question - apart from the fact it is confusing to have one person saying two things, some members will see it as rep-point hunting and report you for abuse.
YorkshireCap 30-Oct-20 16:04pm
   
ok thanks- I added that note/link about the control's own question page to my original post here and deleted the note above.
I am used to other forums, where you "reply" to posts, but here it seems you can only accept a solution or use"Permalink" (whatever that is).
Once a comment has been posted I see you can reply to the comments.
YorkshireCap 30-Oct-20 16:24pm
   
Henry Z. I followed that idea and although it still will not add as a reference or into the toolbox, I tried something new: I dragged the dll into the solution explorer and when I was on top of the project name a plus sign appeared, so I dropped it and now the dll appears under the project files in the solution explorer. However, I still do not see it in the toolbox so I cannot use it.
Is there something I don't know here? Surely a .Net control is a .Net control, so even if this is built in C# it is now a compiled dll designed for .Net so I should be able to use it in the VB.net toolbox and drag the control onto my form?
YorkshireCap 30-Oct-20 17:57pm
   
Hmm, I just tried dragging the dll name from the solution explorer window to the toolbox and it appears there, but only as a text file object.
I also right-clicked on the dll in the solution explorer and selected "Open with... object explorer". The name and properties of the control are then listed, but still,I cannot get the proper control into the toolbox so that i can drag one onto a form.
Henry Z. 30-Oct-20 23:16pm
   
YorkshireCap, can you share with me where I can download the source files so I can investigate your issue more fully...
YorkshireCap 30-Oct-20 23:39pm
   
yes, https://www.codeproject.com/Articles/448562/An-Improved-Version-of-AGauge-A-fast-and-performin#_articleTop
Henry Z. 30-Oct-20 23:53pm
   
a .net control is not universal. Usually a .net control will not work with any .net version but instead is designed for a particular .net version or above furthermore the .net control may be designed for x86 only or x64 only or designed for both x86 and x64. Usually the requirements are found within the documentation for the control.

ok, for my test I created a new Visual studio project, downloaded the .dll, unblocked the dll. I made my visual studio project x86 only and I had to step through the .net versions until the Agauge control properly could be added to the toolbox. I started with .net 2.0, 3.0, 3.5 all of which didnt work than I moved to .net 4.5 which worked . For your project try X86 and target the .net 4.5 version and it should show up properly in the toolbox.
YorkshireCap 31-Oct-20 11:46am
   
I stand enlightened, thank you Henry Z. :)
It's good that I understand what's happening now- I just looked at the article and its date was 2012- so that fits in with needing VS2012; I just didn't realise it.
Sadly I can't use framework 4.5 in vs2008, so I'm out of luck. Can't afford to keep upgrading VS any more- well, not the full version, anyway.
I just thought about using the source code and seeing if I could compile it with my VS2008; haven't compiled a dll since VB6 but should be able to figure it out. Mind you, now that I think of it, the code used is probably related to the framework version, so maybe that will not work.
Otherwise, I just cannot use A.J. Bauers control. I'll have to keep looking.
Thank you again for finding the explanation of what is going on.
Henry Z. 1-Nov-20 0:15am
   
YorkshireCap, I have downloaded the source and have rebuilt the .dll targeting the .Net framework 3.5 now how to I go about getting the .dll to you?
YorkshireCap 1-Nov-20 17:37pm
   
Wow- Thank you so much for doing that.
RCVD- Thank You- Will try tomorrow.

Ok, its tomorrow and the DLL drags into the VS2008 toolbox easily -well done.
Unfortunately, when I try to run, even just with an instance of the control on the form and no changes, I get an exception:---------------------------

System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'AGauge, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
Source="Agauge test1"
StackTrace:
at Agauge_test1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Agauge_test1.My.MyProject.MyForms.get_Form1()
at Agauge_test1.My.MyApplication.OnCreateMainForm() in C:\Users\Username\Documents\Visual Studio 2008\Projects\Agauge test1\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Agauge_test1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.FileNotFoundException
Message="Could not load file or assembly 'AGauge, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
Source="Agauge test1"
FileName="AGauge, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
FusionLog="=== Pre-bind state information ===\r\nLOG: User = PCname\\Username\r\nLOG: DisplayName = AGauge, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null\n (Fully-specified)\r\nLOG: Appbase = file:///C:/Users/Username/Documents/Visual Studio 2008/Projects/Agauge test1/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : Agauge test1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).\r\nLOG: Attempting download of new URL file:///C:/Users/Username/Documents/Visual Studio 2008/Projects/Agauge test1/bin/Debug/AGauge.DLL.\r\nLOG: Attempting download of new URL file:///C:/Users/Username/Documents/Visual Studio 2008/Projects/Agauge test1/bin/Debug/AGauge/AGauge.DLL.\r\nLOG: Attempting download of new URL file:///C:/Users/Username/Documents/Visual Studio 2008/Projects/Agauge test1/bin/Debug/AGauge.EXE.\r\nLOG: Attempting download of new URL file:///C:/Users/Username/Documents/Visual Studio 2008/Projects/Agauge test1/bin/Debug/AGauge/AGauge.EXE.\r\n"
StackTrace:
at Agauge_test1.Form1.InitializeComponent()
at Agauge_test1.Form1..ctor()
InnerException:

I am going to look at the message later to see if I can learn anything from it. It almost looks like it could be looking for a dependency?
Henry Z. 2-Nov-20 22:30pm
   
Yorkshire, I have duplicated the error on myside and have fixed it using a few modifications, please send me another dropbox link so I can give you the updated dll file.
YorkshireCap 3-Nov-20 14:55pm
   
Hi Henry Z. Great- thank you. https://www.dropbox.com/request/x5HjENWmAfzl5i9RdyjT
YorkshireCap 4-Nov-20 18:35pm
   
Aha! Yes, it now runs beautifully. Many thanks, Henry Z, for taking an interest and getting me on my way. I am learning the settings right now and should be able to add this to my simulator project.

By the way, can you share with me what the problem was? Was it a dependency or something else?
Henry Z. 5-Nov-20 0:25am
   
Yorkshire, Glad I could help. I downloaded the original project changed the .net framework and rebuilt the project, however the 1st build had some issues regarding some of the .net dll dependencies were still referencing old higher .net 4.0. So the true fix was to change the .net framework for the project and add the misc .net 3.5 dependencies and rebuild the project/dll.
Add a reference to your project: open the solution in the Solution Explorer pane, open teh project branch, and right click the References twig. Select "Add a reference" and then browse to the DLL file.

Provided it is a .NET assembly, it will be added and you can use it.

If it isn't, then you will get a error message, and you can't use it directly.
If that's the case, try this version: (AGauge) WinForms Gauge Control[^] or this: An Improved Version of AGauge (A fast and performing gauge)[^] in case your DLL file is corrupt.
   
Comments
YorkshireCap 26-Oct-20 18:54pm
   
Thanks Original Griff, that's a different method so I have tried that. Unfortunately it did not work...
I right-clicked on the project in solution explorer, selected "Add Reference...", selected the "Browse" tab, selected the Agauge dll and clicked "OK".
It didn't work so I used your link to download the AGauge_Bin.zip (DLL and Demo) once more, to my "C:\Program Files (x86)\Microsoft Visual Studio 9.0\AGauge_Control-CustomControl" folder.
Then I tried adding the reference again, but unfortunately that didn't work; nothing showed up in the solution explorer. Looking in the project references list, I see the reference title "Agauge", but the path says 'the system cannot find the reference specified'.


Has this tool been successfully added by anyone else? I don't understand why it will not add to my vs2008
Please make sure Windows 10 is not blocking your downloaded dll. Often times Windows 10 will automatically block dlls that have been transferred from one computer to another. You can check to see if your dll is being blocked by right clicking the dll file and choosing properties, than look toward the bottom to see if it's being blocked. You could always do a google image search for "Unblock Dll" which would give you a better visual.
   
Comments
YorkshireCap 28-Oct-20 18:22pm
   
Thank you Henry Z. I have Windows 7 but it was certainly blocked as you suggested, so I unblocked the original zip file then extracted again and tried to add it. Drat- still won't drag in or have a reference added. The reference list still shows "the system cannot find the reference specified".
I also just tried to download the older, original Agauge control, but the web page can no longer be found.
Wow, I only wanted to try and replace my simulator's digit RPM display with a proper dial tachometer. The web page description sounded like it would be easy :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900