|
Do not set a reference to the .DLL file itself. Make your control library project part of the same solution as your application. In your application project, set the reference to the control library project. Do NOT copy .DLL's into the bin folders of your windows app project. This will lead to "unable to find version errors", or problems where you make a change to the library code and can't figure out why the changes don't show up in your windows app.
To this solution, add your installer project. Pick the Setup Wizard to make this a little easier and make sure you add the Primary Output from both the Windows application and Control Library projects.
That should about do it...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you very much for your help.
I did exactly as you directed. The build history is as below:
------ Rebuild All started: Project: NAWADrilcLclLibrary, Configuration: Debug .NET ------
Preparing resources...
Updating references...
Performing main compilation...
Building satellite assemblies...
------ Rebuild All started: Project: DriLCaLc, Configuration: Debug .NET ------
Preparing resources...
Updating references...
Performing main compilation...
Building satellite assemblies...
------ Starting pre-build validation for project 'DriLCaLc Installer' ------
------ Pre-build validation for project 'DriLCaLc Installer' completed ------
------ Rebuild All started: Project: DriLCaLc Installer, Configuration: Debug ------
Building file 'C:\Program Files\NAWA\DriLCaLc Installer\Debug\DriLCaLc Installer.msi'...
WARNING: This setup does not contain the .NET Framework which must be installed on the target machine by running dotnetfx.exe before this setup will install. You can find dotnetfx.exe on the Visual Studio .NET 'Windows Components Update' media. Dotnetfx.exe can be redistributed with your setup.
WARNING: Two or more objects have the same target location ('[targetdir]\nawadrilcalcllibrary.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\nawadrilcalcllibrary.dll')
Packaging file 'NAWADrilcALclLibrary.dll'...
Packaging file '3box.ico'...
Packaging file 'MudCirculatorySystem.rtf'...
Packaging file 'NAWADrilcALclLibrary.dll'...
Packaging file 'Setup.Exe'...
Packaging file 'InstMsiW.Exe'...
Packaging file 'DriLCaLc.exe'...
Packaging file 'Hydraulics.mdb'...
Packaging file 'InstMsiA.Exe'...
---------------------- Done ----------------------
Rebuild All: 3 succeeded, 0 failed, 0 skipped
I noticed that it runs on my developer PC ( before this time if I remove ALL source code and install in my developer PC it would not work.) Now it works. Thank you
How ever I tried to test it on another PC that I have. It installs very well no error but when I try to run it I get the following result.
See the end of this message for details on invoking
Just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeInitializationException: The type initializer for "DriLCaLc.Module1" threw an exception. ---> System.InvalidOperationException: The .Net Data OLE DB Provider(System.Data.OleDb) requires Microsoft Data Access Components(MDAC) version 2.6 or later. Version 2.53.6306.0 was found currently installed.
at System.Data.OleDb.OleDbConnection.CreateInstanceMDAC()
at System.Data.OleDb.OleDbConnection.GetObjectPool(Boolean parsing)
at System.Data.OleDb.OleDbConnection.CreateProvider()
at System.Data.OleDb.OleDbConnection.Open()
at NAWADrilcALclLibrary.Properties_Mud..ctor()
at DriLCaLc.Form1..ctor()
at DriLCaLc.Module1..cctor()
--- End of inner exception stack trace ---
at DriLCaLc.Splash.Splash_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/winnt/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
DriLCaLc
Assembly Version: 1.0.2461.13417
Win32 Version: 1.0.2461.13417
CodeBase: file:///C:/Program%20Files/NAWA/DriLCaLc/DriLCaLc.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/winnt/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/winnt/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
NAWADrilcALclLibrary
Assembly Version: 1.0.2461.13419
Win32 Version: 1.0.2461.13419
CodeBase: file:///C:/Program%20Files/NAWA/DriLCaLc/NAWADrilcALclLibrary.DLL
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/winnt/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/winnt/assembly/gac/system.data/1.0.3300.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/winnt/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
What does it mean?
I tried the whole process again and tried another PC . It also installed well and it also threw this message:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeInitializationException: The type initializer for "DriLCaLc.Module1" threw an exception. ---> System.InvalidOperationException: The .Net Data OLE DB Provider(System.Data.OleDb) requires Microsoft Data Access Components(MDAC) version 2.6 or later. Version 2.53.6200.0 was found currently installed.
at System.Data.OleDb.OleDbConnection.CreateInstanceMDAC()
at System.Data.OleDb.OleDbConnection.GetObjectPool(Boolean parsing)
at System.Data.OleDb.OleDbConnection.CreateProvider()
at System.Data.OleDb.OleDbConnection.Open()
at NAWADrilcALclLibrary.Properties_Mud..ctor()
at DriLCaLc.Form1..ctor()
at DriLCaLc.Module1..cctor()
--- End of inner exception stack trace ---
at DriLCaLc.Splash.Splash_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///f:/winnt/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
DriLCaLc
Assembly Version: 1.0.2461.14474
Win32 Version: 1.0.2461.14474
CodeBase: file:///C:/Program%20Files/NAWA/DriLCaLC/DriLCaLc.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///f:/winnt/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///f:/winnt/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
NAWADrilcALclLibrary
Assembly Version: 1.0.2461.14475
Win32 Version: 1.0.2461.14475
CodeBase: file:///C:/Program%20Files/NAWA/DriLCaLC/NAWADrilcALclLibrary.DLL
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///f:/winnt/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///f:/winnt/assembly/gac/system.data/1.0.3300.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///f:/winnt/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
Also I have some questions to ask
1: What if I am developing the User control for third party use and do not want to share my source code.
2: How can I install the dotnetframework at the same time to avoid the message that always appears in my deployment build history?
Message:
WARNING: This setup does not contain the .NET Framework which must be installed
3: If the developer of the window application is not privy to the source code of the WindowControlLibrary How would the developer of the window application use this .dll
Thank you for your patience.
ihe
|
|
|
|
|
ihe wrote: System.TypeInitializationException: The type initializer for "DriLCaLc.Module1" threw an exception. ---> System.InvalidOperationException: The .Net Data OLE DB Provider(System.Data.OleDb) requires Microsoft Data Access Components(MDAC) version 2.6 or later. Version 2.53.6200.0 was found currently installed.
This means that the machine needs MDAC 2.6 or better installed and it doesn't currently have that. It's a requirement of the .NET Framework so you have no choice but to upgrade it. You can get the latest versions here[^].
ihe wrote: 1: What if I am developing the User control for third party use and do not want to share my source code.
Then look into an obfuscation utility to make it harder to read. You can't encrypt it or make it the code can't be seen, but you can make it harder to read. The Professional version of Visual Studio .NET (and higher) comes with Dotfuscator, Community Edition. You can buy the Professional Edition, but I don't remember what it costs.
ihe wrote: 2: How can I install the dotnetframework at the same time to avoid the message that always appears in my deployment build history?
You can add a Merge Module to the project to get rid of the warning. Right-Click your installer project name, click Add..., then Merge Module... In the list that comes up, find dotNETFXRedist_x86_enu.msm and click on it, then OK.
ihe wrote: 3: If the developer of the window application is not privy to the source code of the WindowControlLibrary How would the developer of the window application use this .dll
The same way we any of the .NET Framework classes. Your .DLL (assembly) is just another set of classes. The developer adds a reference to your .DLL, then either imports its namespace or adds your control(s) to the toolbox.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hi all,
I'am thinking if there's someway i can call an vb exe file when i try to access a certain folder, like at first your gonna select a folder where you're goin to bind your exe, then when u try to access that folder your exe will be launched instead of windows showing the content of that folder...
-::maximus::-
|
|
|
|
|
I doubt that is possible, if it is, it would involve a system wide hook. Not sure you can hook on the opening of a folder.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I don't know of any way to do this. It MAY be possible by writing a Shell Extension (warning! This involves LOTS of COM interop), but I don't know of any examples that are triggered by the selection of a folder, or anything else for that matter.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I don't know if this would work, but if you were to hide the folder and create a shortcuct to your program with the shortcut named the folder name and the folder icon. So when the user clicks on the what they think is the folder, it opens your program, and say, if your program is already open, it just redirects to the folder or something.
Posted by The ANZAC
|
|
|
|
|
|
This is information that should be passed into the method by the caller. Since your .DLL can't determine what type of application is calling it, Application.StartupPath might not have any meaning.
But, if you're absolutely sure that the only thing that will call your method is a Windows Forms app, you can add a reference to the System.Windows.Forms.DLL, then do something like this in your DLL code:
Imports System.Windows.Forms
.
.
.
Dim path As String = Application.StartupPath
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
pl see the code
dim operator as string
operator="+"
there is err in this statement.
pl anyone can suggest me where to declare the var operator iam jus beggner and this is my first ques.
pl solve
Rink
|
|
|
|
|
I don't see any error in this statement. What makes you think otherwise ? What error are you seeing ?
wait - operator is probably a keyword in VS2005, which means it's a word ( like string or dim ) which has special meaning in VB and so you can't use it for a variable name. Try calling it op instead or something.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian is right. "operator" is a keyword and can't be used as a variable name.
It CAN be done though. Although, I don't recommend doing this because it makes your code harder to read. To use a keyword as a variable name, you have to enclose the name in square brackets:
Dim [operator] As String
[operator] = "+"
It's best to just rename the variable to something else:
Dim op As String
op = "+"
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: To use a keyword as a variable name, you have to enclose the name in square brackets:
Dim [operator] As String [operator] = "+"
I didn't know that. Thanks.
|
|
|
|
|
To use a keyword as a variable name, you have to enclose the name in square brackets:
Dim [operator] As String
[operator] = "+"
even i didnt knew that. Thanks.
Nitin...
|
|
|
|
|
im doing project on image processing that include inverse,threshold,smoothing filter,convolution and edge detection function. im using VB 6.0 and currently i only able to load the image. the image im using is bitmap type format. but im stuck at reading the pixel one by one. how am i going to do that? can you give me an example..
|
|
|
|
|
VB6 is pretty close to useless. Can you move to VB.NET ? Apart from being closer to a programming language (:P), you can actually get ALL those filters in C# from my image processing articles on this here site, which will convert easily to VB.NET.
They won't convert to VB6, nor do I think you have any real VB6 options to speak of.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
use CSharp...
i haven't try it before. but someone tell me that it'll work...
|
|
|
|
|
Hi,
I want to populate my list box with data from a column in my table in an SQL Database.
Table name is tbltest, listbox is lstnames and column name is names.
I want to add names from tbltest to lstnames.
Please help.
|
|
|
|
|
Which part are you stuck on ? Do you know SQL ( tragically, lots of people fancy they are writing database apps but don't know SQL nowadays ) ? Do you know how to interact with your database in code ? I assume you know how to set the datasource of a listbox ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
are you trying to answer me or are you just being rude? I am new to this and whould like to learn.
|
|
|
|
|
He's asking you where you're getting stuck. What part of this ListBox procedure are you having a problem with?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
hi there
how to add a combobox to a colum of the flexgrid in visual basics..
thanksin advance
bharath.s
|
|
|
|