|
I don't know of any way that you can force a service to load last, but you can set a dependency on other things. I had an issue where the Message Queue MSMQ needed to load first before my service.
In the ServiceInstaller file you add this:
this._serviceInstaller.ServicesDependedOn = new String[1] {"Message Queuing"};
So if there are other services that need to be running first. Just put there name in the above code instead of the "Message Queuing".
Hope that helps.
Ben
|
|
|
|
|
There used to be some Netscape Browser lines in machine.config. I am not able to locate them in .NET Framework 2.0 machine.config.
Any clues?
|
|
|
|
|
Hi,
I have this problem on closing sockets. When my server initiates it listens request through a tcp port like so...
tcpChannel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(8005);
Now, when my server shuts down and then restarted. It gives me this error,
"only one usage of each socket address (protocol/IP address/port) is permitted."
It seems the port is not closed or there is a timing issue.
The Solution:
So to fix this, I want to scan the socket 8005 and see if its closed or not before my server starts. If it is open, then close it. My server runs on a window service so it can do this. It seems I only have this problem for dual core processors. Other processor worked fine.
So does anybody know how to implement this solution in C# code?
Thanks in advance for any help!
~Jacky
|
|
|
|
|
Hi,
i am working in a Web application, which is using the Setup to install in a system, now i have to customize the MSI Application, for new different cases by using a radio button,i am new to MSI programming possible if so any please send me any resource
Thx for u r help in advance,
|
|
|
|
|
|
I am working on a composite DateTime picker control.
I would like to expose a ValueChanged event when the composite value changes.
Internally, I handle the DateChanged and TimeChanged events.
Private Sub DatePicker_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DatePicker.ValueChanged<br />
If Not bInternal Then<br />
CombineValues()<br />
End If<br />
End Sub<br />
<br />
Private Sub TimePicker_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimePicker.ValueChanged<br />
If Not bInternal Then<br />
CombineValues()<br />
End If<br />
End Sub<br />
<br />
Private Sub CombineValues()<br />
Dim dt As Date = DatePicker.Value<br />
Dim tm As Date = TimePicker.Value<br />
<br />
Dim s As String<br />
s = String.Format("{0} {1}", dt.ToString("d"), tm.ToString("t"))<br />
_date = Date.Parse(s)<br />
End Sub
He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.
|
|
|
|
|
You can create a custom event for your composite control. The subject of creating custom events is a little confusing and lengthy. Check out this article on creating events:
http://www.codeproject.com/vb/net/StepByStepEventsInVBNET.asp[^]
Once you've declared your event to be public you can expose it outside you control just like any other control.
Cheers!
Richard
May your code be error free
|
|
|
|
|
Thanks. I'll check that out.
He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.
|
|
|
|
|
Worked like a charm.
Now to write an article.
He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.
|
|
|
|
|
Hello all,
I'm new to remoting and have been given a task which I'm having trouble with.
We have a bunch of windows services that perform various tasks, running on a remote computer. We need a way to interrogate the services remotely and return a number of given values from variables/props INSIDE the service. This will then be used to create a dashboard of values from our services at any given time so we can see they are all working properly.
I have setup a test program that uses a simple windows service as the component host, which registers my remote object to be instantiated by my test client program.
My question is, how do I refer back from the remoting object to my service to obtain the values required? As far as I can see, the remote object itself has no knowledge of the component host that it was instantiated from. I've read lots of text on remoting but nothing seems to mention access to the component host of the remoting object.
I've tried using ManagementObject and iterating through the services running, and I can find my service, but I can't find a way from there to access the custom properties of my service class, only the base properties of all services. Is there another way to obtain this information using the ManagementObject? Or is there a way from my remote object to reference back to its component host?
I tried using GetActiveObject() as well but that seems to not work for services
Any help would be much appreciated, there's probably a easy way to do this that I can't see.
Thanks
|
|
|
|
|
Im trying to read a xml-file with a StreamReader. For the moment I'm using the following code.
<br />
streamReader = new StreamReader(stream, System.Text.Encoding.Default);<br />
string feedData = streamReader.ReadToEnd(); <br />
I'm using System.Text.Encoding.Default so that I can get some swedish characters working. But I'm having problem when reading a xml-file that's encoded with UTF-8. In the beginning of the xml-files you have the encoding for the file, so I have tried this code:
<br />
streamReader = new StreamReader(stream, System.Text.Encoding.Default);<br />
string feedData = streamReader.ReadLine();<br />
if(feedData.indexOf("UTF-8") != -1)<br />
streamReader = new StreamReader(stream, System.Text.Encoding.UTF-8);<br />
<br />
string feedData += streamReader.ReadToEnd(); <br />
My plan was to read the first line, check if it's encoded with UTF-8 and then change the stream. This doesnt work at all... Is there anyway you can change the encoding for a stream once it's initialized or can you encode the string afterwards?
|
|
|
|
|
Deal ALl,
How would I be able to generate MS Project file .Any Hint/idea would be appreciated.
Regards,
Lq
|
|
|
|
|
Dear gurus,
currently I learn how to write my programs based on plugin-technology in c# and I have a lot of open questions.
Can anybody suggest a good book on this subjet?
Thanks in advance
|
|
|
|
|
There are lots of articles on this subject here at CP. Just enter plugin in the search box to find the list of articles.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Dear friends,
I used the .NET-Treeview [ System.Web.UI.WebControls.TreeView ] to display XML-Data in a tree. This works so far.
But unfortunately there are vertical spaces between the Tree-Nodes, which I cannot remove.
In the MSDN I only found the two members of the TreeNodeStyle-class:
ChildNodesPadding and VerticalPadding
But these properties have the default-value 0,
so I wasn´t able to remove the vertical spaces with setting these properties.
You can see the problem here[^]
Do you know this problem, and know how to remove the vertical spaces?
Thank you,
J.
|
|
|
|
|
Sounds like you need to owner draw your control, which means you need to write all the code that renders a treeview. Is it really worth it ?
What happens if you change those properties ? Can you make them negative ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello Christian,
when
ChildNodesPadding = 0;
and
VerticalPadding = 0;
the TreeView looks like on the picture.
And when I make ChildNodesPadding and VerticalPadding negative, .NET throws an Exception.
Do you know some other parameters I can use,
or how to get this tree look better?
Greetings,
Jan
-- modified at 7:01 Wednesday 28th March, 2007
|
|
|
|
|
I need open new form and close that form, from wich it was opened.
How to do it?
|
|
|
|
|
You create an instance of the form and call ShowDialog(). Then you call Close() to close it.
I recommend buying a book to help you learn this sort of entry level stuff.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thak you for advice
What book you recomend?
|
|
|
|
|
Inside C# used to be good, but there's no 2.0 version. I'd look for a Microsoft Press book, tho, just choose whatever seems to be aimed at your level.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm writing a Windows Explorer-like clone for myself, and I'm running into a problem with empty disk drives.
When I run the application, by building the project, it works as expected. However, if I run the executable directly, I get an error window titled:
".NET-BroacastEventWindow.1.0.3300.0.1: ExplorerPlus.exe - No Disk."
Normally, this error references drive A:. (Which, of course, is empty.)
However, I wrap the appropriate calls in try...catch blocks. In fact, if I remove the try...catch blocks, this error will pop-up before .NET displays its message about the un-caught exception.
This happens for both debug and release versions of the executable. Running the executable directly results in these errors whenever the application accesses an empty drive. However, when the executable runs as a result of the project being built, it runs just fine.
|
|
|
|
|
Hi,
in my Explorer replacement, I used the native function SetErrorMode to avoid
the low-level error reporting taht occurs by default on empty drives.
It works on all .NET versions (tested on XP only).
This is part of my code:
using (new LP_SetErrorMode(ErrorModes.FailCriticalErrors)) {
}
using System;
using System.Runtime.InteropServices;
namespace LP_Core {
[Flags]
public enum ErrorModes {
Default=0x0,
FailCriticalErrors=0x1,
NoOpFaultErrorBox=0x2,
NoAlignmentFaultExcept=0x4,
NoOpenFileErrorBox=0x8000
}
public struct LP_SetErrorMode : IDisposable {
private int oldErrorMode;
public LP_SetErrorMode(ErrorModes mode) {
oldErrorMode=SetErrorMode((int)mode);
}
void IDisposable.Dispose() {
SetErrorMode(oldErrorMode);
}
[DllImport("kernel32.dll")]
private static extern int SetErrorMode(int mode);
}
}
Hope this helps.
|
|
|
|
|
Very ingenious, thank you. It works perfectly.
|
|
|
|
|
Still trying to build a VS60 project in .NET 2003
Now I"m compiling and getting a link error: LINK : fatal error LNK1104: cannot open file 'mfc42.lib'
I thought mfc42.lib would be a known default lib. I also cannot find it in my project to see where its included.
Any ideas? TIA
-C
|
|
|
|