|
what do you mean about dll? is windows library or .net assembly?
if it windows library, then you must copy it to %system% folder because service working directory is not in your application folder, otherwise just add as reference to your service application.
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
Hi, it's actually a .NET assembly so there should not be any problem. It only implements the following code:
namespace TimeLogger
{
public class RandomClass
{
public static int GetRandomNumber()
{
Random rand = new Random();
return rand.Next();
}
}
}
And compiles it as a managed DLL (TestDll.dll). I add a reference to TestDll.dll in my simple service, I add a line which goes: int test = RandomClass.GetRandomNumber() and the service stops working as discussed in my previous message.
What am I missing?
Thanks,
Andrea
|
|
|
|
|
this very strange.
so far, i only have 2 solved problems in service base application:
1. if in start phase, the service take long periods to start, usually there are processes that take time to load. in this case i create a time that run once to trigger that process on timer ticks.
2. if in start phase then stop, there are no process to be done or an error occurred.
your code do not provide any errors. so maybe other member can show you how to solve your problem.
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
Hi Dhaim, I think I've found it! It is simply an installation issue.
In order to install the service, I have configured an external tool in VS2008 with the following parameters:
Title: Install Service
Command: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
Arguments: $(TargetPath)
Init.directory: $(TargetDir)
The uninstall service is the same but adds /u.
Now, launching this command actually installs the service (I have the familiar installutil log and I can start/stop the service as usual), but the service only works correctly if it does not include any dependency! As soon as I add an assembly, installing like this leads to the issue I noticed, for reasons that I'm not able to explain.
If I simply open a VS prompt and install the service "manually" from the command line, everything is fine and the service works as expected.
Thanks for your interest in my issue!
Regards,
Andrea
|
|
|
|
|
Update to the previous message: by carefully inspecting the installation logs, I noticed that by using $(TargetPath), VS was picking a copy of my service exe from the "obj/Debug" folder, and not from the "bin/Debug" folder, which contains the results of the compilation and all the assemblies that I'm referencing!
I could not spot this earlier because I have a long path to the service exe directory, and I did not notice the fact that it contained "obj" instead of "bin"...
For the moment, I have modified the external tool arguments as:
$(BinDir)$(TargetName)$(TargetExt)
which seems to work, even if I suspect there should be a more direct way to accomplish the same task.
Regards,
Andrea
|
|
|
|
|
|
thanks FYI
that's really useful information for me.
Happy coding.
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
Ok I'm not exactly sure if this is the correct place to ask this, but here goes.
I am using a method call AddControl that takes two strings as arguments. The first argument is the "Class Name" of a control, the second is some sort of license code for the control.
For Example, If I wanted to add a Calender, I wold call the function like this:
object obj = AddControl("MSCAL.Calendar", "")
This would add the Microsoft Calendar control and pass me back a pointer so I could access it's methods and properties.
Ok my question is this, I now extend the Calendar control by creating a new c# Control Library project. I can compile and use this control by dragging it from the toolbox and placing it on a form, but I cannot get it to load using the method above. I tried calling it by it's class name TestControl.TestControl, but that doesn't work. I have tried using the GUID as the Class name, but that doesn't seem to work either.
Any help would be appreciated.
John
|
|
|
|
|
Don't you have to add the .dll to your project?
|
|
|
|
|
Of course I added the .dll file as a reference to my project. In fact I even added the control library project as a reference to my current project.
I can add my control to a windows form and it works just fine. It's trying to add it through the specified interface that I am having difficulty with.
|
|
|
|
|
Ok, I solved my own problem so I'm going to post it here.
Instead of using the Custom Control Library as a separate project, I created the control from within my project. The functionality appear to be the same, other than I can't use the control from yet another project.
I guess you would say this is a work around, but not a solution.
John
|
|
|
|
|
Hi
I am using Visual Studio 2005 and MS Access 2003 to create a Windows application in C#.
I have a DataGridView and I programmatically add a DataGridViewComboBoxColumn to the DataGridView. I populate the ComboBoxes in the DataGridViewComboBoxColumn from a lookup table in the database and bind the DataGridView to a DataTable loaded from another table in the database.
However the correct item in the ComboBox does not get selected. In fact nothing is selected in the ComboBox. Looking at my code it feels to me that I am missing something in my code, but I do not know what.
The doctorTable has a Primary key: Doctor_ID
The patientTable has a Foreign key: Doctor_ID
Using the following code snippets:
private void DataController()
{
try
{
this.LoadData_Controller();
this.FormatDataGridView();
dgvPatients.DataSource = patientTable;
}
catch (Exception ex)
{
throw ex;
}
}
private void FormatDataGridView()
{
try
{
#region Format Doctor column
DataGridViewComboBoxColumn comboboxColumnDoctors = new DataGridViewComboBoxColumn();
comboboxColumnDoctors.DataPropertyName = "Doctor";
comboboxColumnDoctors.HeaderText = "Doctor";
comboboxColumnDoctors.DataSource = doctorTable;
comboboxColumnDoctors.ValueMember = "Doctor_ID";
comboboxColumnDoctors.DisplayMember = "DrName";
dgvPatients.Columns.Insert(3, comboboxColumnDoctors);
#endregion
}
catch (Exception ex)
{
throw ex;
}
}
Any help will be greatly appreciated.
Thanks.
Kobus
|
|
|
|
|
Check DataBindings property. I know combobox has this property and hopefully DataGridViewComboBox has it as well. Here you can make each control be ware of the other. If property is not there then simply write some code. For example, when the comboBox is selected, select the appropriate patients which have the foreign key.
|
|
|
|
|
you must remove dgvPatients.Columns.Remove("Doctor_ID");
from the DataGridView
|
|
|
|
|
I had a dll referenced in my project having namespace Utilities. I can access the methods in the namespace by writing Using Utilities at the top of my project and directly I can use Utilities.Class.Method.....
Plz let me know what the exact difference between these two ways.
Thanks,
Bhuvan....
|
|
|
|
|
No difference at all. Except without using Using you have to write Namespace.Class.Method everywhere you want to use that method.
Hope can help
[Edit]
Also it's worthy to search Using in MSDN.
I died as a mineral and became a plant,
I died as plant and rose to animal,
I died as animal and I was Man.
Why should I fear? When was I less by dying?
-- Rumi[^]
My blog
modified on Thursday, December 4, 2008 2:43 AM
|
|
|
|
|
Yep....Thanks....
|
|
|
|
|
Pedram Behroozi wrote: No difference at all.
Not quite. By prefixing the class with the namespace you can avoid name clashes. If two (or more) usings have the same class, then you will get a compiler error if you don't specify the namespace.
Likewise, if you forget to include your namespace via using and there's another namespace using your class name, then you might accidentally use this class. Sure, the signatures won't match, but it can give you some headache because you might not know what the compiler is complaining about.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello all,
I want to know about GNU Make file.
What is Make file & what is the use of it?
|
|
|
|
|
You want too compile C# with it?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
another school assignment
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
i don't understand wht u r saying
|
|
|
|
|
hello all
what is a make file ???/
|
|
|
|
|
It's a batch file used to compile and link a program.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello Guffa
make file / Make file
where it is used?
How it is used?
When it is used?
how related to C#??
Thanks
tony
|
|
|
|