|
KrunalC wrote: I viewed the article you have given prior posting my question.
Yes sorry, that was not helpful, try looking at the System.Threading.Mutex class. I have not proven it but I suspect it could be used to fulfill your requirements.
|
|
|
|
|
Mutex class can help you. If the mode of your application cannot be changed by the user while it is running, then you can create one mutex for "abc" mode and another one for "xyz" mode. For an example of using mutex class to restrict multiple instances have a look at Making the application single-instance section at Window tray minimizer[^]
|
|
|
|
|
Are the multiple instances of the application to be launched on the same system or networked computers?
How many different operating modes are allowed? Two? More than two?
Phil
|
|
|
|
|
Pbraun,
Thanks for your response.
Instances to be launched on the same system only. I have two different operating modes in which my application works. Pls revert with your idea or questions if any.
regards,
Krunal C
|
|
|
|
|
hi .
i create an application that in save operation , save with *.ddi extension.
when a file with this extension (*.ddi) click in windows , want to run my application and show it.
such as *.pdf files that when a user click it Acrobat reader run and show it.
tanks.
|
|
|
|
|
|
Use the FileAssociation class from the link Mentalis[^]
*jaans
|
|
|
|
|
You'll want to change the Main() method of Program.cs to Main(string[] args) , and pass them along to your main Form constructor. And of course your main Form will need another constructor that accepts a string array. In that constructor you can look at the string array for file names, and do with them as you please.
To register the file association, you can do that manually, or if you have an install project you can set up file associations there too.
|
|
|
|
|
How to break For Loop.........in C#
Regards,
KK
|
|
|
|
|
You just said it. Use break. Something like this:
<br />
for (int i = 0; i < 5; i++)<br />
{<br />
<br />
if (i==3)<br />
{<br />
break;<br />
}<br />
}<br />
|
|
|
|
|
Can I point out here that it is generally a bad idea to break out of a loop. This normally means that there is a problem with the design.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have a listbox on a form that displays data from a registry key of value multistring. This listbox is filled when the form loads by this code:
RegistryKey getItems = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\RegKey_test");
if (getItems.GetValue("Items") != null)
{
string[] itemName = (string[])getItems.GetValue("Items");
for (int i = 0; i < itemName.Length; i++)
{
listBox1.Items.Add(getItems.GetValue("Items", itemName));
}
}
This works fine. But when I want to set the listbox items to the registry with the following code, an error occurs:
if (getItems.GetValue("Items") != null)
{ Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "Items", listBox1.Items.ToString(), RegistryValueKind.MultiString); }
I no that something is wrong with this line of code but I am not sure what it is. Can anyone advise me where I am going wrong please?
Lucy
|
|
|
|
|
What error are you getting? Is it an exception? What I don't like is
listBox1.Items.ToString() as listBox1.Items returns ObjectCollection and when you convert it to string you will get name of the type and not the items of listbox.
|
|
|
|
|
I didnt think that part was right. The error it returns is:
The type of the value object did not match the specified RegistryValueKind or the object could not be properly converted.
If I just leave it as listBox1.Items the same error occurs.
|
|
|
|
|
I guess you are getting ArgumentException aren't you?
According to MSDN: "If the type of the specified value does not match the specified valueKind, and the data cannot be converted, ArgumentException is thrown"
If you have a look at definition of RegistryValueKind.MultiString it says: "Specifies an array of null-terminated strings, terminated by two null characters. This value is equivalent to the Win32 API registry data type REG_MULTI_SZ." In reality listbox.Items.ToString() retuns just a string while listbox.Items retuns ObjectCollection which is incompatible too. That's why you are getting the exception.
What are you trying to achieve?
|
|
|
|
|
Yes I am getting an ArgumentException.
I have a form with a listbox. When the form loads, each string in the multistring registry key is put into the listbox as an item. The user can then edit these items as well as removing and adding items. The items then need to be set as values back in the multistring registry key by the click of a button. Does that make sense?
|
|
|
|
|
Lucy_H85 wrote: Does that make sense?
Yes it does. Don't be rude. As I have already written RegistryValueKind.MultiString needs an array of strings. What you are passing is collection of objects. In my opinion you should create an array of string which will contain items from listbox and pass it to SetValue. Hope it helps
|
|
|
|
|
Appologies if I sounded rude but I was not being rude at all. I am not very good at explaining things sometimes so I was genuinly asking if my description was confusing or not.
Thanks for your comments I will try it out now.
Lucy
|
|
|
|
|
Lucy_H85 wrote: Appologies if I sounded rude but I was not being rude at all.
It's ok Please right back if you are still experiencing problems.
|
|
|
|
|
I'm working in C#.Net 2005.
I want to know that is there any solution to set File System Watcher on multi folders???
I'm waiting for quick reply...
Thanx in advance.
Rakesh
|
|
|
|
|
You can include have filesystemwatcher that looks at a directory and its subdirectories. If you need for different directories, then you will need several filesystemwatchers.
|
|
|
|
|
Thankx for your reply.
Is there any other way for multi folder watcher except add as many fileSystemWatcher as many folders that I want set watcher???
Rakesh
|
|
|
|
|
|
Thankx.
But if it is possible than please inform me.
Rakesh
|
|
|
|
|
I am developing a Outlook Shared add-in application using C#.net vs2005.
Here I save some user settings to the user.config file.
The settings are saved.
It is saving in the folder:
C:\Documents and Settings\<user name="">\Local Settings\Application Data\Microsoft_Corporation\<application name="">\10.0.2576
But I want to Store the user.config file in the Location that I Specify.
How can I do this?
I am trying to write a Custom Setting class but even I can’t do this!!!!!
Can this be done?
Is there any link tutor or any resource for this?
Awaiting reply,
Thanks in advance,
SrinivasanPrabakaran
|
|
|
|