|
You could also try creating a Setup Project where you run code to start your service as a Custom Action.
ServiceController sc = new ServiceController("yourServiceName");
sc.Start();
|
|
|
|
|
Hi, I got round that by adding a line into the projectinstaller.cs file.
(Sorry, I hope I get the formatting right, I am new to contributing to this kind of forum.... and pretty new to C# and programming in general)
After the statement:
Public ProjectInstaller()
{
InitialiseComponent();
}
I Added the following:
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
ServiceController controller = new ServiceCOntroller("//Service Name");
controller.Start();
}
You will also need to add using System.ServiceProcess; at the top of the file.
I hope this helps, it took me a while to find the answer searching google.
It works a treat for me.
|
|
|
|
|
if i have an xml file of the following schema : <users><user><username><password><userpicture><game><gamename>
<played><highscore>
to note that the played part take a value 0 or 1 (false or true) , so if i want to get to the the game part and set the gamename, played and highscore what method should i use (knowing that i have many players)
|
|
|
|
|
1. You haven't shown your XML.
2. IMHO, XML forum would have been a decent choice.
3. Going by the information I have, I would go for XPath."No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
You can start by using a descriptive subject line. XML is not very descriptive of you problem
Next clarify your question I know the language. I've read a book. - _Madmatt
|
|
|
|
|
<Users><User><Username></Username><Password></Password><UserPicture></UserPicture><Game><GameName>
</GameName><Played></Played><HighScore></HighScore></Game></User></Users>
|
|
|
|
|
|
Hi All, I need to copy one datagridview to another datagridview .
while I am copying I need also to switch some cells values.
For example , Datagridview1 cell1 should copy to Datagridview2 cell3.
thanks in advance
|
|
|
|
|
Do you want that any change (after copy) in the grid 1 should be reflected in grid 2 as well? "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
d@nish, this is what I have done but it is taking long time
to do that if you have thousands of rows then forget it.
that is why I am looking for any convinent way of doing it or not.
for (int j = 0; j < dataGridView1.Rows.Count; j++)<br />
{<br />
dataGridView2.Rows.Add();<br />
for (int i = 0; i < 5; i++)<br />
{<br />
dataGridView2.Rows[dataGridView2.Rows.Count - 1].Cells[i].Value = dataGridView1.Rows[j].Cells[i].Value; <br />
} <br />
}<br />
<br />
Here I have five coloumns for the second for loop.
|
|
|
|
|
hey,
I would need to capture click event when a file is open. for example, when a user click to open a word doc file, do something to the file b4 opening it with ms word.
|
|
|
|
|
This[^] would give you some idea on this. "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
i tried the mouse click event on compact framework but the HookManager is giving this error:
The type System.Windows.Forms.MoustEventHandler is defined in an assembly that is not referenced. you must add a reference to assembly Systems.Windows.Forms version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
any solution for compact framework??
|
|
|
|
|
how can i save a picture captured by webcam
|
|
|
|
|
naghoumeh14 wrote: how can i save a picture captured by webcam
By writing it out as a series of bytes to a storage medium. You'll have to be more specific to get a less vague answer; what format do you want to store it in, what format is it in when you get the data out of the webcam?"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i need to save the picture captured in the bin/debug of my project and name it.. that's it...
|
|
|
|
|
bin/debug is a folder. He asked do you want to save picture as JPEG/JFIF, Exif, TIFF, RAW, PNG, GIF, BMP or others. And in what format do you get picture?
|
|
|
|
|
http://www.tokenworks.com/products/IDWedge.htm[^]
Hi is there any sample application in .NET is present to read card swipe information from these devices. i thinks this device works as keyboard buffered magnetic swipe reader. It would be great if any one can help
|
|
|
|
|
Hei,
I'm trying to get the Processor IDs of different PCs on the network. It works fine for one PC but when I use it to fetch IDs of more then one PC it return the IDs of first system and gives error at the second PC.
Error
RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
I have search this problem over the net and find this solution.
http://support.microsoft.com/kb/884564[^]
but each time i cant restart the system for taking the id of second PC.'
Any Solution?
ThanksSyed Shahid Hussain
|
|
|
|
|
|
I'm using
<br />
<br />
ManagementScope scope = new ManagementScope("system path");<br />
<br />
<br />
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Processor"); <br />
<br />
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);<br />
<br />
ManagementObjectCollection queryCollection = searcher.Get();<br />
<br />
<pre> Now search here for "ProcessorId" </pre><br />
<br />
Is it the right way?<div class="signature">Syed Shahid Hussain</div>
|
|
|
|
|
|
Thanks Dmitry for ur quick reply.
ur syntax is right. And here i have send the short code. I have called coonnect method and all other thing related to that but problem is here with
scope.connect() When the control comes at this point at the secong time it give this RPC error .
What to do in ur suggestion.
Is there any other way for geting the LAN PC's processor IDs ?
ThanksSyed Shahid Hussain
|
|
|
|
|
Hm...
Maybe this [^] of this [^] will help?Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
Hi everyone.
I'm translating some code from C++ to C# and I've run into a big problem due to the fact that C# is managed and I cannot get the address of the objects I'm handling. (I'm a complete C# newbie so correct me if I'm wrong; I hope I am).
Here's the thing: I'm translating a system that underlies applications and makes sure accesses to shared data are done safely (handles concurrent accesses, etc). For that, whenever a position of the shared memory is accessed there are some measures to be taken, and locks are involved. Memory is segmented so that each 4 words share a lock (too fine a granularity creates high overhead; too coarse, and it greatly reduces parallelism) -- and this is the problem for me. The address of the accessed element is used to map to the lock, but I cannot use addresses in C#, since the garbage collector may relocate objects, etc. I could pin them, but I doubt that would do any good performance-wise.
Instead of addresses I've considered using hash codes (with RuntimeHelpers.GetHashCode), but then I have no way (that I can think of) to control how many memory elements map to the same lock. When using addresses you just shift the address 4 positions to the right, and then you know that you have 4 words mapping to the same lock (assuming addressing by byte and a 32-bit processor), but if you just take a hash code and shift it 4 bits you may end up with very irregular mappings, since hash codes don't need to be consecutive, etc. You may end up with a lock that is mapped by 10 words, and another by 1 or none... This is important for both perfomance and parallelism.
Please tell me that I'm wrong.
Is there a way to do something similar in C#?
Thanks.
|
|
|
|